From 3a02792e3b792b3368ae5ddd9c016d4b9ca10a55 Mon Sep 17 00:00:00 2001 From: Salt Date: Wed, 26 Feb 2020 18:53:20 -0600 Subject: [PATCH] Use handlers for Apache restarts, reorganize Minecraft tasks --- roles/dokuwiki/tasks/main.yml | 6 ++---- roles/gitweb/tasks/main.yml | 6 ++---- roles/minecraft/tasks/main.yml | 18 ++++++++++-------- roles/nextcloud/tasks/main.yml | 7 ++----- roles/redirect/tasks/main.yml | 5 +---- 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/roles/dokuwiki/tasks/main.yml b/roles/dokuwiki/tasks/main.yml index abca1c1..0cf0a83 100644 --- a/roles/dokuwiki/tasks/main.yml +++ b/roles/dokuwiki/tasks/main.yml @@ -27,6 +27,7 @@ remote_src: yes dest: "{{ dokuwiki_webroot }}" extra_opts: [--strip-components=1] + notify: restart apache - name: Chown webroot file: path: "{{ dokuwiki_webroot }}" @@ -43,14 +44,11 @@ template: src: apache2-vhost-ssl.conf dest: "/etc/apache2/sites-enabled/{{ dokuwiki_url }}.conf" + notify: restart apache - name: Generate certificate include_role: name: https vars: website_url: "{{ dokuwiki_url }}" website_webroot: "{{ dokuwiki_webroot }}" - - name: Reload Apache - service: - name: apache2 - state: reloaded become: yes diff --git a/roles/gitweb/tasks/main.yml b/roles/gitweb/tasks/main.yml index af6d437..cf0e718 100644 --- a/roles/gitweb/tasks/main.yml +++ b/roles/gitweb/tasks/main.yml @@ -14,18 +14,16 @@ git: repo: "{{ gitweb_repo }}" dest: "{{ gitweb_webroot }}" + notify: restart apache - name: Copy over virtual host configs template: src: apache2-vhost-ssl.conf dest: "/etc/apache2/sites-enabled/{{ gitweb_url }}.conf" + notify: restart apache - name: Generate certificate include_role: name: https vars: website_url: "{{ gitweb_url }}" website_webroot: "{{ gitweb_webroot }}" - - name: Reload Apache - service: - name: apache2 - state: reloaded become: yes diff --git a/roles/minecraft/tasks/main.yml b/roles/minecraft/tasks/main.yml index 6e1d7d0..e122ec3 100644 --- a/roles/minecraft/tasks/main.yml +++ b/roles/minecraft/tasks/main.yml @@ -61,14 +61,6 @@ file: path: "/var/minecraft/{{ mcname }}/modpack.zip" state: absent - - name: Template out server.properties - template: - src: server.properties - dest: "/var/minecraft/{{ mcname }}/server.properties" - - name: Accept EULA - copy: - src: "eula.txt" - dest: "/var/minecraft/{{ mcname }}/eula.txt" - name: Download Forge get_url: dest: "/var/minecraft/{{ mcname }}/installer.jar" @@ -91,6 +83,16 @@ src: "/var/minecraft/{{ mcname }}/forge-{{ mcforge }}-universal.jar" state: link when: not stat_mcroot_forgejar.stat.exists + - name: Configure server + block: + - name: Template out server.properties + template: + src: server.properties + dest: "/var/minecraft/{{ mcname }}/server.properties" + - name: Accept EULA + copy: + src: "eula.txt" + dest: "/var/minecraft/{{ mcname }}/eula.txt" become: yes become_user: minecraft - name: Enable service diff --git a/roles/nextcloud/tasks/main.yml b/roles/nextcloud/tasks/main.yml index 66a3cdf..dbf65a3 100644 --- a/roles/nextcloud/tasks/main.yml +++ b/roles/nextcloud/tasks/main.yml @@ -49,6 +49,7 @@ remote_src: yes dest: "{{ nextcloud_webroot }}" extra_opts: [--strip-components=1] + notify: restart apache - name: Create data directory file: path: "/var/nextcloud" @@ -79,15 +80,11 @@ template: src: apache2-vhost-ssl.conf dest: "/etc/apache2/sites-enabled/{{ nextcloud_url }}.conf" + notify: restart apache - name: Generate certificate include_role: name: https vars: website_url: "{{ nextcloud_url }}" website_webroot: "{{ nextcloud_webroot }}" - - name: Reload Apache - service: - name: apache2 - state: reloaded - enabled: true become: yes diff --git a/roles/redirect/tasks/main.yml b/roles/redirect/tasks/main.yml index 715c3ea..24f8de0 100644 --- a/roles/redirect/tasks/main.yml +++ b/roles/redirect/tasks/main.yml @@ -7,13 +7,10 @@ template: src: apache2-redirect.conf dest: "/etc/apache2/sites-enabled/{{ redirect_from }}.conf" + notify: restart apache - name: Generate certificate include_role: name: https vars: website_url: "{{ redirect_from }}" - - name: Reload Apache - service: - name: apache2 - state: reloaded become: yes