From 79c5c341823fd15a877485541b2f71e309ae7943 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:30:15 -0600 Subject: [PATCH 01/19] move SHIMS --- roles/{nginx => elgg}/templates/elgg-nginx.conf | 0 roles/{nginx => lokole}/templates/lokole-nginx.conf.j2 | 0 roles/{nginx => moodle}/templates/moodle-nginx.conf.j2 | 0 roles/{nginx => nextcloud}/templates/nextcloud-nginx.conf | 0 roles/{nginx => nodered}/templates/nodered-nginx.conf.j2 | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename roles/{nginx => elgg}/templates/elgg-nginx.conf (100%) rename roles/{nginx => lokole}/templates/lokole-nginx.conf.j2 (100%) rename roles/{nginx => moodle}/templates/moodle-nginx.conf.j2 (100%) rename roles/{nginx => nextcloud}/templates/nextcloud-nginx.conf (100%) rename roles/{nginx => nodered}/templates/nodered-nginx.conf.j2 (100%) diff --git a/roles/nginx/templates/elgg-nginx.conf b/roles/elgg/templates/elgg-nginx.conf similarity index 100% rename from roles/nginx/templates/elgg-nginx.conf rename to roles/elgg/templates/elgg-nginx.conf diff --git a/roles/nginx/templates/lokole-nginx.conf.j2 b/roles/lokole/templates/lokole-nginx.conf.j2 similarity index 100% rename from roles/nginx/templates/lokole-nginx.conf.j2 rename to roles/lokole/templates/lokole-nginx.conf.j2 diff --git a/roles/nginx/templates/moodle-nginx.conf.j2 b/roles/moodle/templates/moodle-nginx.conf.j2 similarity index 100% rename from roles/nginx/templates/moodle-nginx.conf.j2 rename to roles/moodle/templates/moodle-nginx.conf.j2 diff --git a/roles/nginx/templates/nextcloud-nginx.conf b/roles/nextcloud/templates/nextcloud-nginx.conf similarity index 100% rename from roles/nginx/templates/nextcloud-nginx.conf rename to roles/nextcloud/templates/nextcloud-nginx.conf diff --git a/roles/nginx/templates/nodered-nginx.conf.j2 b/roles/nodered/templates/nodered-nginx.conf.j2 similarity index 100% rename from roles/nginx/templates/nodered-nginx.conf.j2 rename to roles/nodered/templates/nodered-nginx.conf.j2 From 31522b22cb5f7ece1fd6abaf7464ea0fedc54ce9 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:28:47 -0600 Subject: [PATCH 02/19] move dokuwiki shim --- roles/dokuwiki/tasks/enable.yml | 14 ++++++++++++++ roles/dokuwiki/templates/dokuwiki-nginx.conf | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 roles/dokuwiki/templates/dokuwiki-nginx.conf diff --git a/roles/dokuwiki/tasks/enable.yml b/roles/dokuwiki/tasks/enable.yml index 9e035e214..4b54a5cf0 100644 --- a/roles/dokuwiki/tasks/enable.yml +++ b/roles/dokuwiki/tasks/enable.yml @@ -11,11 +11,25 @@ state: absent when: not dokuwiki_enabled and is_debuntu +- name: Install {{ nginx_config_dir }}/dokuwiki-nginx.conf SHIM from template + template: + src: dokuwiki-nginx.conf + dest: "{{ nginx_config_dir }}/dokuwiki-nginx.conf" + when: dokuwiki_enabled and nginx_enabled + - name: Restart Apache ({{ apache_service }}) to enable/disable DokuWiki's http://box/wiki systemd: name: "{{ apache_service }}" daemon_reload: yes state: restarted + when: apache_enabled + +- name: Restart nginx to enable/disable DokuWiki's http://box/wiki + systemd: + name: nginx + daemon_reload: yes + state: restarted + when: nginx_enabled - name: Add 'dokuwiki' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/dokuwiki/templates/dokuwiki-nginx.conf b/roles/dokuwiki/templates/dokuwiki-nginx.conf new file mode 100644 index 000000000..9bbfe2cf7 --- /dev/null +++ b/roles/dokuwiki/templates/dokuwiki-nginx.conf @@ -0,0 +1,3 @@ +location {{ dokuwiki_url }} { + proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }}; +} From 86fc754acc583729e74ac0f10d886595790e812f Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:38:35 -0600 Subject: [PATCH 03/19] elgg - moved shim --- roles/elgg/tasks/enable.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/roles/elgg/tasks/enable.yml b/roles/elgg/tasks/enable.yml index 3fa10ed9f..632112c49 100644 --- a/roles/elgg/tasks/enable.yml +++ b/roles/elgg/tasks/enable.yml @@ -17,10 +17,25 @@ state: absent when: not elgg_enabled and is_redhat +- name: Install {{ nginx_config_dir }}/elgg-nginx.conf from template + template: + src: elgg-nginx.conf + dest: "{{ nginx_config_dir }}/elgg-nginx.conf" + when: elgg_enabled and nginx_enabled + - name: Restart Apache ({{ apache_service }}) to enable/disable http://box/elgg - service: + systemd: name: "{{ apache_service }}" + daemon_reload: yes state: restarted + when: apache_enabled + +- name: Restart nginx to enable/disable http://box/elgg + systemd: + name: nginx + daemon_reload: yes + state: restarted + when: nginx_enabled - name: Add 'elgg' variable values to {{ iiab_ini_file }} ini_file: From 6eb8f20de62e0dce21e76ce29516066c1f8baf61 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:41:53 -0600 Subject: [PATCH 04/19] lokole - moved shim --- roles/lokole/tasks/enable.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/roles/lokole/tasks/enable.yml b/roles/lokole/tasks/enable.yml index 5d6803bf5..df6ae2ca4 100644 --- a/roles/lokole/tasks/enable.yml +++ b/roles/lokole/tasks/enable.yml @@ -4,7 +4,7 @@ name: lokole enabled: yes state: restarted - when: lokole_enabled | bool + when: lokole_enabled - name: Disable 'lokole' service, if not lokole_enabled systemd: @@ -38,11 +38,25 @@ state: absent when: (not lokole_enabled) and (not is_debuntu) +- name: Install {{ nginx_config_dir }}/lokole-nginx.conf from template + template: + src: lokole-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/lokole-nginx.conf" + when: lokole_enabled and nginx_enabled + - name: Restart Apache ({{ apache_service }}) to enable/disable http://box/lokole systemd: - daemon_reload: yes name: "{{ apache_service }}" + daemon_reload: yes state: restarted + when: apache_enabled + +- name: Restart nginx to enable/disable http://box/lokole + systemd: + name: nginx + daemon_reload: yes + state: restarted + when: nginx_enabled - name: Add 'lokole' variable values to {{ iiab_ini_file }} ini_file: From fc509f43f12bbc9561c6833562781d99363ee07c Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:47:41 -0600 Subject: [PATCH 05/19] nextcloud shims --- roles/nextcloud/tasks/enable.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/nextcloud/tasks/enable.yml b/roles/nextcloud/tasks/enable.yml index 0c49b4822..793b974ed 100644 --- a/roles/nextcloud/tasks/enable.yml +++ b/roles/nextcloud/tasks/enable.yml @@ -23,11 +23,25 @@ state: absent when: not nextcloud_enabled and is_redhat +- name: Install Nextcloud's nginx conf.d file from template + template: + src: nextcloud-nginx.conf + dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf" + when: nextcloud_enabled and nginx_enabled + - name: Restart {{ apache_service }}, enabling/disabling http://box/nextcloud systemd: name: "{{ apache_service }}" daemon-reload: yes state: restarted + when: apache_enabled | bool + +- name: Restart nginx enabling/disabling http://box/nextcloud + systemd: + name: nginx + daemon-reload: yes + state: restarted + when: nginx_enabled - name: Add 'nextcloud' variable values to {{ iiab_ini_file }} ini_file: From 604f7edded2db105648184e482b3d79c187fd571 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 05:55:29 -0600 Subject: [PATCH 06/19] nodered - moved shim --- roles/nodered/tasks/enable.yml | 51 ++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/roles/nodered/tasks/enable.yml b/roles/nodered/tasks/enable.yml index 1e4ade2f1..296cf3f92 100644 --- a/roles/nodered/tasks/enable.yml +++ b/roles/nodered/tasks/enable.yml @@ -1,25 +1,10 @@ -- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled) - file: - src: /etc/apache2/sites-available/nodered.conf - dest: /etc/apache2/sites-enabled/nodered.conf - owner: root - group: root - state: link - when: nodered_enabled | bool - -- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled) - file: - path: /etc/apache2/sites-enabled/nodered.conf - state: absent - when: not nodered_enabled - - name: Enable & (Re)start 'nodered' systemd service (if nodered_enabled) systemd: daemon_reload: yes name: nodered enabled: yes state: restarted - when: nodered_enabled | bool + when: nodered_enabled - name: Disable & Stop 'nodered' systemd service (if not nodered_enabled) systemd: @@ -29,11 +14,43 @@ state: stopped when: not nodered_enabled +- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled) + file: + src: /etc/apache2/sites-available/nodered.conf + dest: /etc/apache2/sites-enabled/nodered.conf + owner: root + group: root + state: link + when: nodered_enabled + +- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled) + file: + path: /etc/apache2/sites-enabled/nodered.conf + state: absent + when: not nodered_enabled + +- name: Install NodeRed's nginx conf.d file from template + template: + src: nodered-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/nodered-nginx.conf" + owner: root + group: root + mode: 0666 + when: nodered_enabled and nginx_enabled + - name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered) systemd: name: "{{ apache_service }}" # httpd or apache2 + daemon-reload: yes state: restarted - when: nodered_install | bool + when: apache_enabled + +- name: Restart nginx to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered) + systemd: + name: nginx + state: restarted + daemon-reload: yes + when: nginx_enabled - name: Add 'nodered' variable values to {{ iiab_ini_file }} ini_file: From 27679ada01df42b5ca9b7718ee58d86560b72faa Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 06:28:19 -0600 Subject: [PATCH 07/19] nginx - disable helpers --- roles/nginx/tasks/main.yml | 43 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index a85c08855..78576d900 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -1,14 +1,3 @@ -- name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf" - template: - src: "{{ item.src}}" - dest: "{{ item.dest }}" - with_items: - - { src: "server.conf", dest: "/etc/nginx/" } - - { src: "nginx.conf", dest: "/etc/nginx/" } - - { src: "ports.conf", dest: "/etc/{{ apache_service }}/" } - - { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" } - when: nginx_enabled | bool - - name: Remove stale files (usb-lib.conf, modules.conf) from {{ nginx_config_dir }} file: state: absent @@ -22,19 +11,29 @@ name: "{{ apache_service }}" state: stopped +- name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf" + template: + src: "{{ item.src}}" + dest: "{{ item.dest }}" + with_items: + - { src: "server.conf", dest: "/etc/nginx/" } + - { src: "nginx.conf", dest: "/etc/nginx/" } + - { src: "ports.conf", dest: "/etc/{{ apache_service }}/" } + - { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" } + when: nginx_enabled | bool + # the below slides in nginx's proxypass config files for apache on localhost # via the ports.conf file installed above -- name: Install proxpass to Apache running on localhost port {{ apache_port }} - include_tasks: uses_apache.yml - when: nginx_enabled | bool +#- name: Install proxpass to apache running on localhost port {{ apache_port }} +# include_tasks: uses_apache.yml +# when: apache_enabled # the below task contains the same logic contained in the playbooks to enable # 'runrole nginx' to do the right thing but with the 'src' path set to role's # templates path ie roles//template/ - -- name: Install proxpass to other services 'dual mode' roles - include_tasks: only_nginx.yml - when: nginx_enabled | bool +#- name: Install proxpass to other services 'dual mode' roles +# include_tasks: only_nginx.yml +# when: nginx_enabled - name: Stop and disable NGINX when not nginx_enabled systemd: @@ -50,9 +49,9 @@ when: not nginx_enabled # should have the logic to handle both modes in the playbook -- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is disabled - include_tasks: disable.yml - when: not nginx_enabled +#- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is diabled +# include_tasks: disable.yml +# when: not nginx_enabled - name: Enable & Restart Apache, since we stopped it ({{ apache_service }}) systemd: @@ -60,7 +59,7 @@ daemon_reload: yes state: restarted enabled: true - when: apache_enabled | bool + when: apache_enabled | bool or not nginx_enabled | bool - name: Enable & Restart NGINX, to pick up the config files installed systemd: From 725a7df59b2e2ebe883949726d62a92be92a6a64 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 03:14:54 -0600 Subject: [PATCH 08/19] use set_fact apache_enabled: True for apache apps --- roles/0-init/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index 79b09ae92..e0d7d915d 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -105,6 +105,11 @@ gui_port: 443 when: adm_cons_force_ssl | bool +- name: Turn on Apache for (dokuwiki elgg lokole moodle nodered nextcloud) + set_fact: + apache_enabled: True + when: dokuwiki_install or elgg_install or lokole_install or moodle_install or nodered_install or nextcloud_install + - name: Turn on both vars for MySQL (mandatory in Stage 3!) set_fact: mysql_install: True From 60ddaf593caf2079c1fa1babbc7a7a942292cad4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 03:18:13 -0600 Subject: [PATCH 09/19] default apache_enabled: False --- vars/default_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index d4c4d04bb..f363a9e18 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -232,7 +232,7 @@ admin_console_enabled: True # variables related to introduction of nginx # apache apache_install: True -apache_enabled: True +apache_enabled: False apache_port: "8090" apache_interface: "127.0.0.1" # The following variable, if True, allows Admin Console to poweroff IIAB From fff83cd5fb5425809244548e5ebf4be83efae134 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 12:12:49 -0500 Subject: [PATCH 10/19] Refine @jvonau\'s \'Move NGINX shims to roles\' --- roles/dokuwiki/defaults/main.yml | 3 +- roles/dokuwiki/tasks/enable.yml | 49 +++++++------- roles/dokuwiki/tasks/install.yml | 46 +++++++------ ...wiki-nginx.conf => dokuwiki-nginx.conf.j2} | 4 +- roles/elgg/tasks/enable.yml | 54 ++++++++-------- roles/elgg/tasks/install.yml | 6 +- roles/elgg/tasks/setup.yml | 8 +-- roles/elgg/templates/elgg-nginx.conf | 3 - roles/elgg/templates/elgg-nginx.conf.j2 | 3 + roles/elgg/templates/elggdb.sql.j2 | 2 +- roles/lokole/tasks/enable.yml | 64 ++++++++----------- roles/lokole/tasks/install.yml | 41 ++++-------- roles/lokole/templates/lokole-nginx.conf.j2 | 4 +- roles/moodle/tasks/install.yml | 19 +++--- roles/moodle/templates/moodle-nginx.conf.j2 | 2 +- roles/nextcloud/tasks/enable.yml | 58 ++++++++--------- roles/nextcloud/tasks/install.yml | 12 +--- ...oud-nginx.conf => nextcloud-nginx.conf.j2} | 7 +- roles/nginx/tasks/main.yml | 30 ++++----- roles/nodered/tasks/enable.yml | 61 +++++++++--------- roles/nodered/tasks/install.yml | 14 ++-- roles/nodered/templates/nodered-nginx.conf.j2 | 4 +- 22 files changed, 223 insertions(+), 271 deletions(-) rename roles/dokuwiki/templates/{dokuwiki-nginx.conf => dokuwiki-nginx.conf.j2} (65%) delete mode 100644 roles/elgg/templates/elgg-nginx.conf create mode 100644 roles/elgg/templates/elgg-nginx.conf.j2 rename roles/nextcloud/templates/{nextcloud-nginx.conf => nextcloud-nginx.conf.j2} (56%) diff --git a/roles/dokuwiki/defaults/main.yml b/roles/dokuwiki/defaults/main.yml index f55e8affb..7d1e83dc1 100644 --- a/roles/dokuwiki/defaults/main.yml +++ b/roles/dokuwiki/defaults/main.yml @@ -1,8 +1,9 @@ # dokuwiki_install: False # dokuwiki_enabled: False +# dokuwiki_url: /dokuwiki + # All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml # If nec, change them by editing /etc/iiab/local_vars.yml prior to installing! dokuwiki_version: "dokuwiki-2018-04-22b" -dokuwiki_url: /wiki diff --git a/roles/dokuwiki/tasks/enable.yml b/roles/dokuwiki/tasks/enable.yml index 4b54a5cf0..55df3cfae 100644 --- a/roles/dokuwiki/tasks/enable.yml +++ b/roles/dokuwiki/tasks/enable.yml @@ -1,35 +1,39 @@ -- name: Symlink /etc/apache2/sites-enabled/dokuwiki.conf to /etc/apache2/sites-available/dokuwiki.conf if dokuwiki_enabled (debuntu) - file: - src: /etc/apache2/sites-available/dokuwiki.conf - path: /etc/apache2/sites-enabled/dokuwiki.conf - state: link - when: dokuwiki_enabled and is_debuntu +# Apache -- name: Remove symlink /etc/apache2/sites-enabled/dokuwiki.conf if not dokuwiki_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/dokuwiki.conf - state: absent - when: not dokuwiki_enabled and is_debuntu +- name: Enable http://box{{ dokuwiki_url }} via Apache # http://box/dokuwiki + command: a2ensite dokuwiki.conf + when: apache_install and dokuwiki_enabled -- name: Install {{ nginx_config_dir }}/dokuwiki-nginx.conf SHIM from template - template: - src: dokuwiki-nginx.conf - dest: "{{ nginx_config_dir }}/dokuwiki-nginx.conf" - when: dokuwiki_enabled and nginx_enabled +- name: Disable http://box{{ dokuwiki_url }} via Apache # http://box/dokuwiki + command: a2dissite dokuwiki.conf + when: apache_install and not dokuwiki_enabled -- name: Restart Apache ({{ apache_service }}) to enable/disable DokuWiki's http://box/wiki +- name: Restart Apache systemd service ({{ apache_service }}) systemd: name: "{{ apache_service }}" - daemon_reload: yes state: restarted - when: apache_enabled + when: apache_enabled | bool -- name: Restart nginx to enable/disable DokuWiki's http://box/wiki +# NGINX + +- name: "SHIM: Enable http://box{{ dokuwiki_url }} via NGINX, by installing {{ nginx_config_dir }}/dokuwiki-nginx.conf from template" # http://box/dokuwiki + template: + src: dokuwiki-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/dokuwiki-nginx.conf" + when: nginx_install and dokuwiki_enabled + +- name: "SHIM: Disable http://box{{ dokuwiki_url }} via NGINX, by removing {{ nginx_config_dir }}/dokuwiki-nginx.conf" # http://box/dokuwiki + file: + path: "{{ nginx_config_dir }}/dokuwiki-nginx.conf" + state: absent + when: nginx_install and not dokuwiki_enabled + +- name: Restart 'nginx' systemd service systemd: name: nginx - daemon_reload: yes state: restarted - when: nginx_enabled + when: nginx_enabled | bool + - name: Add 'dokuwiki' variable values to {{ iiab_ini_file }} ini_file: @@ -46,4 +50,3 @@ value: "{{ dokuwiki_install }}" - option: enabled value: "{{ dokuwiki_enabled }}" - diff --git a/roles/dokuwiki/tasks/install.yml b/roles/dokuwiki/tasks/install.yml index eb75aa8ef..2477fe5ee 100644 --- a/roles/dokuwiki/tasks/install.yml +++ b/roles/dokuwiki/tasks/install.yml @@ -11,7 +11,15 @@ dest: /library creates: "/library/{{ dokuwiki_version }}/VERSION" -- name: Symlink /library/dokuwiki to /library/{{ dokuwiki_version }} +- name: Ensure dir /library/{{ dokuwiki_version }} is owned by {{ apache_user }} with 644/755 permissions + file: + path: "/library/{{ dokuwiki_version }}" + owner: "{{ apache_user }}" + mode: u+rw,go+r,go-w # '0755' had forced 'x' bits for non-dirs + state: directory + recurse: yes + +- name: Symlink /library/dokuwiki -> /library/{{ dokuwiki_version }} #shell: if [ ! -d /library/dokuwiki ]; then ln -sf /library/{{ dokuwiki_version }} /library/dokuwiki; fi #shell: ln -sf /library/{{ dokuwiki_version }} /library/dokuwiki #BOTH LINES ABOVE FAIL TO UPDATE LINK; Ansible approach below works @@ -21,36 +29,26 @@ state: link force: yes -- name: Install /etc/{{ apache_config_dir }}/dokuwiki.conf from template, for DokuWiki's http://box/wiki +- name: Install /etc/{{ apache_config_dir }}/dokuwiki.conf from template, for DokuWiki's http://box{{ dokuwiki_url }} template: src: dokuwiki.conf.j2 dest: "/etc/{{ apache_config_dir }}/dokuwiki.conf" - when: dokuwiki_enabled | bool -- name: Symlink /etc/apache2/sites-enabled/dokuwiki.conf to /etc/apache2/sites-available/dokuwiki.conf if dokuwiki_enabled (debuntu) - file: - src: /etc/apache2/sites-available/dokuwiki.conf - path: /etc/apache2/sites-enabled/dokuwiki.conf - state: link - when: dokuwiki_enabled and is_debuntu - -- name: Remove symlink /etc/apache2/sites-enabled/dokuwiki.conf if not dokuwiki_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/dokuwiki.conf - state: absent - when: not dokuwiki_enabled and is_debuntu - -- name: Set /library/{{ dokuwiki_version }} owner to {{ apache_user }} and permissions to 0755 (recursively) - file: - path: "/library/{{ dokuwiki_version }}" - owner: "{{ apache_user }}" - mode: 0755 - state: directory - recurse: yes +# - name: Symlink /etc/apache2/sites-enabled/dokuwiki.conf to /etc/apache2/sites-available/dokuwiki.conf if dokuwiki_enabled (debuntu) +# file: +# src: /etc/apache2/sites-available/dokuwiki.conf +# path: /etc/apache2/sites-enabled/dokuwiki.conf +# state: link +# when: dokuwiki_enabled and is_debuntu +# +# - name: Remove symlink /etc/apache2/sites-enabled/dokuwiki.conf if not dokuwiki_enabled (debuntu) +# file: +# path: /etc/apache2/sites-enabled/dokuwiki.conf +# state: absent +# when: not dokuwiki_enabled and is_debuntu - name: "Add 'dokuwiki_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^dokuwiki_installed' line: 'dokuwiki_installed: True' - state: present diff --git a/roles/dokuwiki/templates/dokuwiki-nginx.conf b/roles/dokuwiki/templates/dokuwiki-nginx.conf.j2 similarity index 65% rename from roles/dokuwiki/templates/dokuwiki-nginx.conf rename to roles/dokuwiki/templates/dokuwiki-nginx.conf.j2 index 9bbfe2cf7..e2ad3a147 100644 --- a/roles/dokuwiki/templates/dokuwiki-nginx.conf +++ b/roles/dokuwiki/templates/dokuwiki-nginx.conf.j2 @@ -1,3 +1,3 @@ -location {{ dokuwiki_url }} { - proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }}; +location {{ dokuwiki_url }}/ { + proxy_pass http://127.0.0.1:{{ apache_port }}{{ dokuwiki_url }}/; } diff --git a/roles/elgg/tasks/enable.yml b/roles/elgg/tasks/enable.yml index 632112c49..e28c84323 100644 --- a/roles/elgg/tasks/enable.yml +++ b/roles/elgg/tasks/enable.yml @@ -1,41 +1,39 @@ -- name: Create symlink elgg.conf from sites-enabled to sites-available (debuntu, not nec for redhat) - file: - src: /etc/apache2/sites-available/elgg.conf - path: /etc/apache2/sites-enabled/elgg.conf - state: link - when: elgg_enabled and is_debuntu +# Apache -- name: Remove symlink /etc/apache2/sites-enabled/elgg.conf (debuntu) - file: - path: /etc/apache2/sites-enabled/elgg.conf - state: absent - when: not elgg_enabled and is_debuntu +- name: Enable http://box{{ elgg_url }} via Apache # http://box/elgg + command: a2ensite elgg.conf + when: apache_install and elgg_enabled -- name: Remove Apache's elgg.conf (redhat) - file: - dest: "/etc/{{ apache_config_dir }}/elgg.conf" - state: absent - when: not elgg_enabled and is_redhat +- name: Disable http://box{{ elgg_url }} via Apache # http://box/elgg + command: a2dissite elgg.conf + when: apache_install and not elgg_enabled -- name: Install {{ nginx_config_dir }}/elgg-nginx.conf from template - template: - src: elgg-nginx.conf - dest: "{{ nginx_config_dir }}/elgg-nginx.conf" - when: elgg_enabled and nginx_enabled - -- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/elgg +- name: Restart Apache systemd service ({{ apache_service }}) systemd: name: "{{ apache_service }}" - daemon_reload: yes state: restarted - when: apache_enabled + when: apache_enabled | bool -- name: Restart nginx to enable/disable http://box/elgg +# NGINX + +- name: "SHIM: Enable http://box{{ elgg_url }} via NGINX, by installing {{ nginx_config_dir }}/elgg-nginx.conf from template" # http://box/elgg + template: + src: elgg-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/elgg-nginx.conf" + when: nginx_install and elgg_enabled + +- name: "SHIM: Disable http://box{{ elgg_url }} via NGINX, by removing {{ nginx_config_dir }}/elgg-nginx.conf" # http://box/elgg + file: + path: "{{ nginx_config_dir }}/elgg-nginx.conf" + state: absent + when: nginx_install and not elgg_enabled + +- name: Restart 'nginx' systemd service systemd: name: nginx - daemon_reload: yes state: restarted - when: nginx_enabled + when: nginx_enabled | bool + - name: Add 'elgg' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/elgg/tasks/install.yml b/roles/elgg/tasks/install.yml index e2ff1c872..f2b90c8dd 100644 --- a/roles/elgg/tasks/install.yml +++ b/roles/elgg/tasks/install.yml @@ -53,7 +53,7 @@ group: "{{ apache_user }}" #regexp='^#RewriteBase' -- name: Change .htaccess to include RewriteBase for http://box/elgg +- name: Change .htaccess to include RewriteBase for http://box{{ elgg_url }} # http://box/elgg lineinfile: backup: no path: "/opt/{{ elgg_xx }}/.htaccess" @@ -82,7 +82,7 @@ state: directory owner: "{{ apache_user }}" -- name: Install /etc/{{ apache_config_dir }}/elgg.conf from template, for http://box/elgg +- name: Install /etc/{{ apache_config_dir }}/elgg.conf from template, for http://box{{ elgg_url }} # http://box/elgg template: src: elgg.conf dest: "/etc/{{ apache_config_dir }}/elgg.conf" @@ -92,5 +92,3 @@ dest: "{{ iiab_state_file }}" regexp: '^elgg_installed' line: 'elgg_installed: True' - state: present - diff --git a/roles/elgg/tasks/setup.yml b/roles/elgg/tasks/setup.yml index 66ded083f..d38811fca 100644 --- a/roles/elgg/tasks/setup.yml +++ b/roles/elgg/tasks/setup.yml @@ -3,7 +3,7 @@ name: "{{ dbname }}" register: create_elgg_database -- name: Create user/password to access Elgg database - can be run more than once +- name: Create MySQL user {{ dbuser }} and password to access Elgg database - can be run more than once mysql_user: name: "{{ dbuser }}" host: "{{ item }}" @@ -16,8 +16,8 @@ - name: Create /tmp/elggdb.sql from template, to load database template: - src: "elggdb.sql.j2" - dest: "/tmp/elggdb.sql" + src: elggdb.sql.j2 + dest: /tmp/elggdb.sql # elggdb.sql obtained with mysqldump --skip-add-drop-table elggdb > elggdb.sql # tar up a mysqldump of freshly installed database and use it in the install to avoid the startup @@ -28,7 +28,7 @@ name: "{{ dbname }}" state: import target: /tmp/elggdb.sql - when: create_elgg_database.changed + when: create_elgg_database.changed | bool - name: Remove database dump /tmp/elggdb.sql file: diff --git a/roles/elgg/templates/elgg-nginx.conf b/roles/elgg/templates/elgg-nginx.conf deleted file mode 100644 index 8687f4853..000000000 --- a/roles/elgg/templates/elgg-nginx.conf +++ /dev/null @@ -1,3 +0,0 @@ -location /elgg { - proxy_pass http://127.0.0.1:{{ apache_port }}/elgg; -} diff --git a/roles/elgg/templates/elgg-nginx.conf.j2 b/roles/elgg/templates/elgg-nginx.conf.j2 new file mode 100644 index 000000000..f0b7dff82 --- /dev/null +++ b/roles/elgg/templates/elgg-nginx.conf.j2 @@ -0,0 +1,3 @@ +location {{ elgg_url }}/ { + proxy_pass http://127.0.0.1:{{ apache_port }}{{ elgg_url }}/; +} diff --git a/roles/elgg/templates/elggdb.sql.j2 b/roles/elgg/templates/elggdb.sql.j2 index 4fdd987df..6c66d397d 100644 --- a/roles/elgg/templates/elggdb.sql.j2 +++ b/roles/elgg/templates/elggdb.sql.j2 @@ -541,7 +541,7 @@ CREATE TABLE `elgg_sites_entity` ( LOCK TABLES `elgg_sites_entity` WRITE; /*!40000 ALTER TABLE `elgg_sites_entity` DISABLE KEYS */; -INSERT INTO `elgg_sites_entity` VALUES (1,'My New Community','','http://box/elgg/'); +INSERT INTO `elgg_sites_entity` VALUES (1,'My New Community','','http://box{{ elgg_url }}/'); /*!40000 ALTER TABLE `elgg_sites_entity` ENABLE KEYS */; UNLOCK TABLES; diff --git a/roles/lokole/tasks/enable.yml b/roles/lokole/tasks/enable.yml index df6ae2ca4..981925e85 100644 --- a/roles/lokole/tasks/enable.yml +++ b/roles/lokole/tasks/enable.yml @@ -1,62 +1,54 @@ -- name: Enable & Restart 'lokole' systemd service, with daemon_reload, if lokole_enabled +- name: Enable & Restart 'lokole' systemd service systemd: - daemon_reload: yes name: lokole + daemon_reload: yes enabled: yes state: restarted - when: lokole_enabled + when: lokole_enabled | bool -- name: Disable 'lokole' service, if not lokole_enabled +- name: Disable & Stop 'lokole' systemd service systemd: - daemon_reload: yes name: lokole enabled: no state: stopped when: not lokole_enabled -- name: Install /etc/{{ apache_config_dir }}/lokole.conf from template, for http://box/lokole - template: - src: lokole.conf.j2 - dest: "/etc/{{ apache_config_dir }}/lokole.conf" +# Apache -- name: Symlink /etc/apache2/sites-enabled/lokole.conf to /etc/{{ apache_config_dir }}/lokole.conf, if lokole_enabled (debuntu) - file: - src: "/etc/{{ apache_config_dir }}/lokole.conf" - path: /etc/apache2/sites-enabled/lokole.conf - state: link - when: lokole_enabled and is_debuntu +- name: Enable http://box{{ lokole_url }} via Apache # http://box/lokole + command: a2ensite lokole.conf + when: apache_install and lokole_enabled -- name: Remove /etc/apache2/sites-enabled/lokole.conf, if not lokole_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/lokole.conf - state: absent - when: not lokole_enabled and is_debuntu +- name: Disable http://box{{ lokole_url }} via Apache # http://box/lokole + command: a2dissite lokole.conf + when: apache_install and not lokole_enabled -- name: Remove /etc/{{ apache_config_dir }}/lokole.conf, if not lokole_enabled (OS's other than debuntu) - file: - path: "/etc/{{ apache_config_dir }}/lokole.conf" - state: absent - when: (not lokole_enabled) and (not is_debuntu) +- name: Restart Apache systemd service ({{ apache_service }}) + systemd: + name: "{{ apache_service }}" + state: restarted + when: apache_enabled | bool -- name: Install {{ nginx_config_dir }}/lokole-nginx.conf from template +# NGINX + +- name: "SHIM: Enable http://box{{ lokole_url }} via NGINX, by installing {{ nginx_config_dir }}/lokole-nginx.conf from template" # http://box/lokole template: src: lokole-nginx.conf.j2 dest: "{{ nginx_config_dir }}/lokole-nginx.conf" - when: lokole_enabled and nginx_enabled + when: nginx_install and lokole_enabled -- name: Restart Apache ({{ apache_service }}) to enable/disable http://box/lokole - systemd: - name: "{{ apache_service }}" - daemon_reload: yes - state: restarted - when: apache_enabled +- name: "SHIM: Disable http://box{{ lokole_url }} via NGINX, by removing {{ nginx_config_dir }}/lokole-nginx.conf" # http://box/lokole + file: + path: "{{ nginx_config_dir }}/lokole-nginx.conf" + state: absent + when: nginx_install and not lokole_enabled -- name: Restart nginx to enable/disable http://box/lokole +- name: Restart 'nginx' systemd service systemd: name: nginx - daemon_reload: yes state: restarted - when: nginx_enabled + when: nginx_enabled | bool + - name: Add 'lokole' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/lokole/tasks/install.yml b/roles/lokole/tasks/install.yml index 896ac8486..e7c42a340 100644 --- a/roles/lokole/tasks/install.yml +++ b/roles/lokole/tasks/install.yml @@ -13,8 +13,6 @@ #- bcrypt does not exist on Ubuntu 19.10 - python3-bcrypt # 2019-10-14: should work across modern Linux OS's state: present - tags: - - install - name: pip install opwen_email_client (Lokole) {{ lokole_version }} from PyPI to {{ lokole_venv }} pip: @@ -23,8 +21,6 @@ virtualenv: "{{ lokole_venv }}" virtualenv_command: python3 -m venv "{{ lokole_venv }}" extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/ - tags: - - install when: - internet_available | bool - lokole_commit is undefined @@ -39,8 +35,6 @@ virtualenv: "{{ lokole_venv }}" virtualenv_command: python3 -m venv "{{ lokole_venv }}" extra_args: --no-cache-dir # To avoid caching issues e.g. soon after new releases hit https://pypi.org/project/opwen-email-client/ - tags: - - install when: - internet_available | bool - lokole_commit is defined @@ -51,56 +45,49 @@ {{ lokole_venv }}/bin/pybabel compile -d {{ item }}/translations with_items: - "{{ lokole_venv }}/lib/python${python_version}/site-packages/opwen_email_client/webapp" - tags: - - install - name: Create dir {{ lokole_run_directory }} file: path: "{{ lokole_run_directory }}" state: directory - tags: - - configure - name: Install {{ lokole_run_directory }}/webapp_secrets.sh from template, to configure Lokole template: src: webapp_secrets.sh.j2 dest: "{{ lokole_run_directory }}/webapp_secrets.sh" - tags: - - configure - name: Install {{ lokole_run_directory }}/webapp.sh from template, to configure Gunicorn template: src: webapp.sh.j2 dest: "{{ lokole_run_directory }}/webapp.sh" mode: a+x - tags: - - configure - name: Create admin user shell: | . {{ lokole_run_directory }}/webapp_secrets.sh {{ lokole_venv }}/bin/manage.py createadmin --name='{{ lokole_admin_user }}' --password='{{ lokole_admin_password }}' - tags: - - configure -- name: Install unit file /etc/systemd/system/lokole.service from template +- name: Install /etc/{{ apache_config_dir }}/lokole.conf from template, for http://box{{ lokole_url }} via Apache # http://box/lokole + template: + src: lokole.conf.j2 + dest: "/etc/{{ apache_config_dir }}/lokole.conf" + when: apache_install | bool + +- name: Install /etc/systemd/system/lokole.service unit file from template template: src: lokole.service.j2 dest: /etc/systemd/system/lokole.service - tags: - - systemd -- name: Enable & Restart 'lokole' systemd service, with daemon_reload, if lokole_enabled - systemd: - daemon_reload: yes - name: lokole - enabled: yes - state: restarted - when: lokole_enabled | bool +# - name: Enable & Restart 'lokole' systemd service, with daemon_reload, if lokole_enabled +# systemd: +# daemon_reload: yes +# name: lokole +# enabled: yes +# state: restarted +# when: lokole_enabled | bool - name: "Add 'lokole_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^lokole_installed' line: 'lokole_installed: True' - state: present diff --git a/roles/lokole/templates/lokole-nginx.conf.j2 b/roles/lokole/templates/lokole-nginx.conf.j2 index bedf791b3..b6d793d53 100644 --- a/roles/lokole/templates/lokole-nginx.conf.j2 +++ b/roles/lokole/templates/lokole-nginx.conf.j2 @@ -1,3 +1,3 @@ -location /lokole { - proxy_pass http://127.0.0.1:{{ apache_port }}/lokole; +location {{ lokole_url }}/ { + proxy_pass http://127.0.0.1:{{ apache_port }}{{ lokole_url }}/; } diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index c41607c54..2b93d6b7b 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -52,11 +52,11 @@ recurse: yes state: directory -- name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }} with write permission 0755 +- name: Create dir {{ content_base }}/dbdata/moodle owned by {{ apache_user }} file: path: "{{ content_base }}/dbdata/moodle" owner: "{{ apache_user }}" - mode: 0755 + # mode: '0755' state: directory - name: Create dir {{ moodle_data }} owned by {{ apache_user }}:{{ apache_user }} with write permission 0770 # /library/moodle @@ -64,7 +64,7 @@ path: "{{ moodle_data }}" owner: "{{ apache_user }}" group: "{{ apache_user }}" - mode: 0770 + mode: '0770' state: directory - name: Remove Apache's stock moodle.conf @@ -76,9 +76,9 @@ template: src: 022-moodle.j2 dest: "/etc/{{ apache_config_dir }}/022-moodle.conf" - owner: root - group: root - mode: 0644 + # owner: root + # group: root + # mode: '0644' - name: Restart postgresql-iiab service: @@ -109,7 +109,7 @@ template: src: moodle_installer dest: "{{ moodle_base }}" - mode: 0755 + mode: '0755' - name: Enable & Restart postgresql-iiab service: @@ -118,7 +118,7 @@ enabled: yes when: moodle_enabled | bool -- name: Restart Apache service ({{ apache_service }}) +- name: Restart Apache systemd service ({{ apache_service }}) service: name: "{{ apache_service }}" state: restarted @@ -136,11 +136,10 @@ #command: chown -R {{ apache_user }} {{ moodle_base }} file: path: "{{ moodle_base }}/config.php" - mode: 0644 + mode: '0644' - name: "Add 'moodle_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^moodle_installed' line: 'moodle_installed: True' - state: present diff --git a/roles/moodle/templates/moodle-nginx.conf.j2 b/roles/moodle/templates/moodle-nginx.conf.j2 index a06e6baf3..eea1b9f39 100644 --- a/roles/moodle/templates/moodle-nginx.conf.j2 +++ b/roles/moodle/templates/moodle-nginx.conf.j2 @@ -4,10 +4,10 @@ location /moodle { proxy_set_header Host $host; proxy_pass http://127.0.0.1:{{ apache_port }}; } + location ~ ^/moodle.*\.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:{{ apache_port }}; } - diff --git a/roles/nextcloud/tasks/enable.yml b/roles/nextcloud/tasks/enable.yml index 793b974ed..332669c8e 100644 --- a/roles/nextcloud/tasks/enable.yml +++ b/roles/nextcloud/tasks/enable.yml @@ -1,47 +1,39 @@ -# This should go in computed_network.yml, but here for now -#- name: Compute Nextcloud listen ip addr for nextcloud.conf -# set_fact: -# nextcloud_required_ip: "{{ ansible_default_ipv4.network }}/{{ ansible_default_ipv4.netmask }}" -# when: ansible_default_ipv4.network is defined +# Apache -- name: Create symlink nextcloud.conf from sites-enabled to sites-available for http://box/nextcloud (debuntu) - file: - src: "/etc/{{ apache_config_dir }}/nextcloud.conf" - path: /etc/apache2/sites-enabled/nextcloud.conf - state: link - when: nextcloud_enabled and is_debuntu +- name: Enable http://box{{ nextcloud_url }} via Apache # http://box/nextcloud + command: a2ensite nextcloud.conf + when: apache_install and nextcloud_enabled -- name: Remove symlink nextcloud.conf from /etc/apache2/sites-enabled if not nextcloud_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/nextcloud.conf - state: absent - when: not nextcloud_enabled and is_debuntu +- name: Disable http://box{{ nextcloud_url }} via Apache # http://box/nextcloud + command: a2dissite nextcloud.conf + when: apache_install and not nextcloud_enabled -- name: Remove sites-available/nextcloud.conf if not nextcloud_enabled (redhat) - file: - path: "/etc/{{ apache_config_dir }}/nextcloud.conf" - state: absent - when: not nextcloud_enabled and is_redhat - -- name: Install Nextcloud's nginx conf.d file from template - template: - src: nextcloud-nginx.conf - dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf" - when: nextcloud_enabled and nginx_enabled - -- name: Restart {{ apache_service }}, enabling/disabling http://box/nextcloud +- name: Restart Apache systemd service ({{ apache_service }}) systemd: name: "{{ apache_service }}" - daemon-reload: yes state: restarted when: apache_enabled | bool -- name: Restart nginx enabling/disabling http://box/nextcloud +# NGINX + +- name: "SHIM: Enable http://box{{ nextcloud_url }} via NGINX, by installing {{ nginx_config_dir }}/nextcloud-nginx.conf from template" # http://box/nextcloud + template: + src: nextcloud-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/nextcloud-nginx.conf" + when: nginx_install and nextcloud_enabled + +- name: "SHIM: Disable http://box{{ nextcloud_url }} via NGINX, by removing {{ nginx_config_dir }}/nextcloud-nginx.conf" # http://box/nextcloud + file: + path: "{{ nginx_config_dir }}/nextcloud-nginx.conf" + state: absent + when: nginx_install and not nextcloud_enabled + +- name: Restart 'nginx' systemd service systemd: name: nginx - daemon-reload: yes state: restarted - when: nginx_enabled + when: nginx_enabled | bool + - name: Add 'nextcloud' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/nextcloud/tasks/install.yml b/roles/nextcloud/tasks/install.yml index 0c6dd658a..ca45f96d3 100644 --- a/roles/nextcloud/tasks/install.yml +++ b/roles/nextcloud/tasks/install.yml @@ -49,8 +49,6 @@ #validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954 #async: 1800 #poll: 10 - tags: - - download when: internet_available and not php_new #when: internet_available and nextcloud_force_install and (is_debian_9 or is_raspbian_9 or is_ubuntu_16) @@ -63,8 +61,6 @@ #validate_certs: False # TEMPORARY ON/AFTER 2018-07-22 AS download.nextcloud.com CERT EXPIRED: https://github.com/iiab/iiab/issues/954 #async: 1800 #poll: 10 - tags: - - download when: internet_available and php_new #when: internet_available and nextcloud_force_install and not (is_debian_9 or is_raspbian_9 or is_ubuntu_16) @@ -155,7 +151,7 @@ dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php" owner: "{{ apache_user }}" group: "{{ apache_user }}" - mode: 0640 + mode: '0640' when: is_centos | bool - name: chown -R {{ apache_user }}:{{ apache_user }} {{ nextcloud_prefix }}/nextcloud @@ -171,20 +167,16 @@ path: "{{ nextcloud_data_dir }}" owner: "{{ apache_user }}" group: "{{ apache_user }}" - mode: 0750 + mode: '0750' state: directory - name: Install Apache's nextcloud.conf from template, for http://box/nextcloud template: src: nextcloud.conf.j2 dest: "/etc/{{ apache_config_dir }}/nextcloud.conf" - owner: root - group: root - mode: 0644 - name: "Add 'nextcloud_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^nextcloud_installed' line: 'nextcloud_installed: True' - state: present diff --git a/roles/nextcloud/templates/nextcloud-nginx.conf b/roles/nextcloud/templates/nextcloud-nginx.conf.j2 similarity index 56% rename from roles/nextcloud/templates/nextcloud-nginx.conf rename to roles/nextcloud/templates/nextcloud-nginx.conf.j2 index 114baf77b..3e0b3e6b2 100644 --- a/roles/nextcloud/templates/nextcloud-nginx.conf +++ b/roles/nextcloud/templates/nextcloud-nginx.conf.j2 @@ -1,11 +1,10 @@ -location /nextcloud { - proxy_pass http://127.0.0.1:{{ apache_port }}/nextcloud; +location {{ nextcloud_url }} { + proxy_pass http://127.0.0.1:{{ apache_port }}{{ nextcloud_url }}; } -location ~ /nextcloud/.*\.php$ { +location ~ {{ nextcloud_url }}/.*\.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:{{ apache_port }}; } - diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 78576d900..1331301de 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -1,7 +1,7 @@ - name: Remove stale files (usb-lib.conf, modules.conf) from {{ nginx_config_dir }} file: - state: absent - path: "{{ item.path }}" + path: "{{ item.path }}" + state: absent with_items: - { path: "{{ nginx_config_dir }}/usb-lib.conf" } - { path: "{{ nginx_config_dir }}/modules.conf" } @@ -13,43 +13,43 @@ - name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf" template: - src: "{{ item.src}}" - dest: "{{ item.dest }}" + src: "{{ item.src}}" + dest: "{{ item.dest }}" with_items: - - { src: "server.conf", dest: "/etc/nginx/" } - - { src: "nginx.conf", dest: "/etc/nginx/" } - - { src: "ports.conf", dest: "/etc/{{ apache_service }}/" } - - { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" } + - { src: 'server.conf', dest: '/etc/nginx/' } + - { src: 'nginx.conf', dest: '/etc/nginx/' } + - { src: 'ports.conf', dest: "/etc/{{ apache_service }}/" } + - { src: 'iiab.conf.j2', dest: "{{ nginx_config_dir }}/iiab.conf" } when: nginx_enabled | bool # the below slides in nginx's proxypass config files for apache on localhost # via the ports.conf file installed above -#- name: Install proxpass to apache running on localhost port {{ apache_port }} +#- name: Install proxpass to Apache running on localhost port {{ apache_port }} # include_tasks: uses_apache.yml -# when: apache_enabled +# when: apache_enabled | bool # the below task contains the same logic contained in the playbooks to enable # 'runrole nginx' to do the right thing but with the 'src' path set to role's # templates path ie roles//template/ #- name: Install proxpass to other services 'dual mode' roles # include_tasks: only_nginx.yml -# when: nginx_enabled +# when: nginx_enabled | bool -- name: Stop and disable NGINX when not nginx_enabled +- name: Stop and disable NGINX, when not nginx_enabled systemd: name: nginx state: stopped enabled: false when: not nginx_enabled -- name: Disable Apache port {{ apache_port }} localhost only +- name: Disable Apache port {{ apache_port }} localhost only, when not nginx_enabled template: dest: /etc/{{ apache_service }}/ports.conf src: stock-apache-ports.conf when: not nginx_enabled # should have the logic to handle both modes in the playbook -#- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is diabled +#- name: Enable Apache (a2ensite) for 'dual mode' for the role when NGINX is disabled # include_tasks: disable.yml # when: not nginx_enabled @@ -59,7 +59,7 @@ daemon_reload: yes state: restarted enabled: true - when: apache_enabled | bool or not nginx_enabled | bool + when: apache_enabled or not nginx_enabled - name: Enable & Restart NGINX, to pick up the config files installed systemd: diff --git a/roles/nodered/tasks/enable.yml b/roles/nodered/tasks/enable.yml index 296cf3f92..a6ba2d28c 100644 --- a/roles/nodered/tasks/enable.yml +++ b/roles/nodered/tasks/enable.yml @@ -1,56 +1,55 @@ -- name: Enable & (Re)start 'nodered' systemd service (if nodered_enabled) +- name: Enable & (Re)start 'nodered' systemd service systemd: - daemon_reload: yes name: nodered + daemon_reload: yes enabled: yes state: restarted when: nodered_enabled -- name: Disable & Stop 'nodered' systemd service (if not nodered_enabled) +- name: Disable & Stop 'nodered' systemd service systemd: - daemon_reload: yes name: nodered enabled: no state: stopped when: not nodered_enabled -- name: Create symlink nodered.conf from sites-enabled to sites-available, for short URL http://box/nodered (if nodered_enabled) - file: - src: /etc/apache2/sites-available/nodered.conf - dest: /etc/apache2/sites-enabled/nodered.conf - owner: root - group: root - state: link - when: nodered_enabled +# Apache -- name: Remove symlink /etc/apache2/sites-enabled/nodered.conf (if not nodered_enabled) - file: - path: /etc/apache2/sites-enabled/nodered.conf - state: absent - when: not nodered_enabled +- name: Enable http://box/nodered via Apache + command: a2ensite nodered.conf + when: apache_install and nodered_enabled -- name: Install NodeRed's nginx conf.d file from template +- name: Disable http://box/nodered via Apache + command: a2dissite nodered.conf + when: apache_install and not nodered_enabled + +- name: Restart Apache systemd service ({{ apache_service }}) + systemd: + name: "{{ apache_service }}" + state: restarted + when: apache_enabled | bool + +# NGINX + +- name: "SHIM: Enable http://box/nodered_url via NGINX, by installing {{ nginx_config_dir }}/nodered-nginx.conf from template" template: src: nodered-nginx.conf.j2 dest: "{{ nginx_config_dir }}/nodered-nginx.conf" - owner: root - group: root - mode: 0666 - when: nodered_enabled and nginx_enabled + # mode: '0666' + when: nginx_install and nodered_enabled -- name: Restart Apache service ({{ apache_service }}) to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered) - systemd: - name: "{{ apache_service }}" # httpd or apache2 - daemon-reload: yes - state: restarted - when: apache_enabled +- name: "SHIM: Disable http://box/nodered_url via NGINX, by removing {{ nginx_config_dir }}/nodered-nginx.conf" + file: + path: "{{ nginx_config_dir }}/nodered-nginx.conf" + state: absent + when: nginx_install and not nodered_enabled -- name: Restart nginx to enable/disable http://box/nodered (not just http://box:{{ nodered_port }}/nodered) +- name: Restart 'nginx' systemd service systemd: name: nginx state: restarted - daemon-reload: yes - when: nginx_enabled + when: nginx_enabled | bool + - name: Add 'nodered' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/nodered/tasks/install.yml b/roles/nodered/tasks/install.yml index 490c2171e..fb92b7c5e 100644 --- a/roles/nodered/tasks/install.yml +++ b/roles/nodered/tasks/install.yml @@ -78,18 +78,14 @@ backup: yes src: nodered.service.j2 dest: /etc/systemd/system/nodered.service - owner: root - group: root - mode: 0666 + # mode: '0666' -- name: Install Apache's sites-available/nodered.conf from template +- name: Install /etc/{{ apache_config_dir }}/nodered.conf from template template: backup: yes src: nodered.conf.j2 - dest: /etc/apache2/sites-available/nodered.conf - owner: root - group: root - mode: 0666 + dest: "/etc/{{ apache_config_dir }}/nodered.conf" + # mode: '0666' # SEE ALSO THE apache2_module SECTION IN roles/httpd/tasks/main.yml - name: Enable proxy_wstunnel apache2 module @@ -102,5 +98,3 @@ dest: "{{ iiab_state_file }}" regexp: '^nodered_installed' line: 'nodered_installed: True' - state: present - diff --git a/roles/nodered/templates/nodered-nginx.conf.j2 b/roles/nodered/templates/nodered-nginx.conf.j2 index 275dd98a5..7d4728b16 100644 --- a/roles/nodered/templates/nodered-nginx.conf.j2 +++ b/roles/nodered/templates/nodered-nginx.conf.j2 @@ -1,3 +1,3 @@ -location /nodered { - proxy_pass http://127.0.0.1:{{ apache_port }}/nodered; +location /nodered/ { + proxy_pass http://127.0.0.1:{{ apache_port }}/nodered/; } From 0cc20fbaf3cc800cf58b41b10343ed307f0d1e70 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 12:32:01 -0500 Subject: [PATCH 11/19] Enable Apache in 0-init/tasks/main.yml if svcs need it --- roles/0-init/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index e0d7d915d..53fedcd50 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -105,10 +105,11 @@ gui_port: 443 when: adm_cons_force_ssl | bool -- name: Turn on Apache for (dokuwiki elgg lokole moodle nodered nextcloud) +# SEE: https://github.com/iiab/iiab/blob/master/roles/nginx/README.md +- name: Enable Apache if any of {DokuWiki, Elgg, Lokole, Moodle, Nextcloud, Node-RED} are set to install set_fact: apache_enabled: True - when: dokuwiki_install or elgg_install or lokole_install or moodle_install or nodered_install or nextcloud_install + when: dokuwiki_install or elgg_install or lokole_install or moodle_install or nextcloud_install or nodered_install - name: Turn on both vars for MySQL (mandatory in Stage 3!) set_fact: From 8db70d90842a9cfd705e5964f2f3034eacb8a2f7 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 12:37:41 -0500 Subject: [PATCH 12/19] Clarify Apache's changing role in roles/nginx/README.md --- roles/nginx/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/nginx/README.md b/roles/nginx/README.md index e49e46418..ec457ba0a 100644 --- a/roles/nginx/README.md +++ b/roles/nginx/README.md @@ -14,7 +14,7 @@ * usb-lib * wordpress - 2. Dual support, see https://github.com/iiab/iiab/blob/master/roles/nginx/tasks/only_nginx.yml + 2. Dual support, see [roles/nginx/tasks/only_nginx.yml](tasks/only_nginx.yml) * awstats ([#2124](https://github.com/iiab/iiab/issues/2124)) * calibre-web * gitea @@ -22,7 +22,7 @@ * kolibri * sugarizer - 3. Still proxied to Apache, see [PR #2131](https://github.com/iiab/iiab/pull/2131) & https://github.com/iiab/iiab/blob/master/roles/nginx/tasks/uses_apache.yml + 3. Still proxied to Apache, see [roles/0-init/tasks/main.yml#L108-L112](../0-init/tasks/main.yml#L108-L112) & [roles/nginx/tasks/uses_apache.yml](tasks/uses_apache.yml) * dokuwiki ([#2056](https://github.com/iiab/iiab/issues/2056)) * elgg * lokole From f31397ad264e30d5721ee50254067e956461f85a Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 12:51:39 -0500 Subject: [PATCH 13/19] pbx blurb < 80 chars --- roles/pbx/defaults/main.yml | 2 +- vars/default_vars.yml | 2 +- vars/local_vars_big.yml | 2 +- vars/local_vars_medium.yml | 2 +- vars/local_vars_min.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/pbx/defaults/main.yml b/roles/pbx/defaults/main.yml index d8f834bd1..9d2c46051 100644 --- a/roles/pbx/defaults/main.yml +++ b/roles/pbx/defaults/main.yml @@ -1,5 +1,5 @@ # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. -# Works on Ubuntu 18.04, Debian 9. Experimental on Rasp/RPi 3. Uses Node.js 10.x +# Works on Ubuntu 18.04, Debian 9 w/ Node.js 10.x. Experimental on RPi 3. # pbx_install: False # pbx_enabled: False diff --git a/vars/default_vars.yml b/vars/default_vars.yml index d4c4d04bb..924c1b23a 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -394,7 +394,7 @@ nextcloud_allow_public_ips: False # nextcloud_dl_url: http://d.iiab.io/packages # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. -# Works on Ubuntu 18.04, Debian 9. Experimental on Rasp/RPi 3. Uses Node.js 10.x +# Works on Ubuntu 18.04, Debian 9 w/ Node.js 10.x. Experimental on RPi 3. pbx_install: False pbx_enabled: False asterisk_chan_dongle: False diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 1e2355f7c..da202a8ac 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -250,7 +250,7 @@ nextcloud_allow_public_ips: False # nextcloud_dl_url: http://d.iiab.io/packages # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. -# Works on Ubuntu 18.04, Debian 9. Experimental on Rasp/RPi 3. Uses Node.js 10.x +# Works on Ubuntu 18.04, Debian 9 w/ Node.js 10.x. Experimental on RPi 3. pbx_install: False pbx_enabled: False asterisk_chan_dongle: False diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index 3a84c1e86..0147a270f 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -250,7 +250,7 @@ nextcloud_allow_public_ips: False # nextcloud_dl_url: http://d.iiab.io/packages # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. -# Works on Ubuntu 18.04, Debian 9. Experimental on Rasp/RPi 3. Uses Node.js 10.x +# Works on Ubuntu 18.04, Debian 9 w/ Node.js 10.x. Experimental on RPi 3. pbx_install: False pbx_enabled: False asterisk_chan_dongle: False diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index 5087ba947..1c6b49bab 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -250,7 +250,7 @@ nextcloud_allow_public_ips: False # nextcloud_dl_url: http://d.iiab.io/packages # A full-featured PBX (for rural telephony, etc) based on Asterisk and FreePBX. -# Works on Ubuntu 18.04, Debian 9. Experimental on Rasp/RPi 3. Uses Node.js 10.x +# Works on Ubuntu 18.04, Debian 9 w/ Node.js 10.x. Experimental on RPi 3. pbx_install: False pbx_enabled: False asterisk_chan_dongle: False From 74bf520a2055de9273d98672888f480084288cdb Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 14:20:35 -0500 Subject: [PATCH 14/19] Typo in explanation @ nginx/tasks/only_nginx.yml --- roles/nginx/tasks/only_nginx.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nginx/tasks/only_nginx.yml b/roles/nginx/tasks/only_nginx.yml index 73f9f7c7a..47bc76e99 100644 --- a/roles/nginx/tasks/only_nginx.yml +++ b/roles/nginx/tasks/only_nginx.yml @@ -1,4 +1,4 @@ -# The ~100 lines of code below is near-identical to what's in tasks/enable.yml +# The ~100 lines of code below are near-identical to what's in tasks/enable.yml # for these 6 playbooks. Any way we can consolidate / reduce duplication? From bd915fcdaea303a4e09e4c8b33b9c29bc67251a4 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 17:06:24 -0500 Subject: [PATCH 15/19] 35 tasks/*.yml writing to iiab_state.yml --- roles/awstats/tasks/install.yml | 1 - roles/azuracast/tasks/install.yml | 1 - roles/bluetooth/tasks/install.yml | 1 - roles/calibre-web/tasks/install.yml | 1 - roles/calibre/tasks/install.yml | 3 +-- roles/captiveportal/tasks/main.yml | 2 -- roles/cups/tasks/main.yml | 22 +++++++-------- roles/gitea/tasks/install.yml | 1 - roles/httpd/tasks/install.yml | 12 ++++++--- roles/internetarchive/tasks/install.yml | 1 - roles/kalite/tasks/install.yml | 7 +++++ roles/kalite/tasks/setup.yml | 8 +++--- roles/kiwix/tasks/install.yml | 1 - roles/kolibri/tasks/install.yml | 1 - roles/mediawiki/tasks/install.yml | 1 - roles/minetest/tasks/provision.yml | 14 ++++------ roles/mongodb/tasks/install.yml | 1 - roles/monit/tasks/install.yml | 6 +++++ roles/mosquitto/tasks/install.yml | 1 - roles/munin/tasks/install.yml | 1 - roles/network/tasks/dansguardian.yml | 11 ++++---- roles/network/tasks/dhcpd.yml | 21 +++++---------- roles/network/tasks/named.yml | 36 +++++++------------------ roles/network/tasks/squid.yml | 7 ++--- roles/network/tasks/wondershaper.yml | 27 +++++++++---------- roles/nginx/tasks/install.yml | 6 +++++ roles/samba/tasks/main.yml | 1 - roles/sugarizer/tasks/install.yml | 1 - roles/teamviewer/tasks/install.yml | 6 +++++ roles/wordpress/tasks/install.yml | 1 - 30 files changed, 90 insertions(+), 113 deletions(-) diff --git a/roles/awstats/tasks/install.yml b/roles/awstats/tasks/install.yml index 6a19e4ae6..e4fa353a4 100644 --- a/roles/awstats/tasks/install.yml +++ b/roles/awstats/tasks/install.yml @@ -81,4 +81,3 @@ dest: "{{ iiab_state_file }}" regexp: '^awstats_installed' line: 'awstats_installed: True' - state: present diff --git a/roles/azuracast/tasks/install.yml b/roles/azuracast/tasks/install.yml index 3fe7808e5..6014a0dc1 100644 --- a/roles/azuracast/tasks/install.yml +++ b/roles/azuracast/tasks/install.yml @@ -69,4 +69,3 @@ dest: "{{ iiab_state_file }}" regexp: '^azuracast_installed' line: 'azuracast_installed: True' - state: present diff --git a/roles/bluetooth/tasks/install.yml b/roles/bluetooth/tasks/install.yml index b9f7b4e91..b127a9455 100644 --- a/roles/bluetooth/tasks/install.yml +++ b/roles/bluetooth/tasks/install.yml @@ -60,4 +60,3 @@ dest: "{{ iiab_state_file }}" regexp: '^bluetooth_installed' line: 'bluetooth_installed: True' - state: present diff --git a/roles/calibre-web/tasks/install.yml b/roles/calibre-web/tasks/install.yml index 4a29c3ec5..242e0fd3a 100644 --- a/roles/calibre-web/tasks/install.yml +++ b/roles/calibre-web/tasks/install.yml @@ -107,4 +107,3 @@ dest: "{{ iiab_state_file }}" regexp: '^calibreweb_installed' line: 'calibreweb_installed: True' - state: present diff --git a/roles/calibre/tasks/install.yml b/roles/calibre/tasks/install.yml index 08f607214..a8a3ff269 100644 --- a/roles/calibre/tasks/install.yml +++ b/roles/calibre/tasks/install.yml @@ -82,6 +82,5 @@ - name: "Add 'calibre_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" - regexp: '^calibreweb_installed' + regexp: '^calibre_installed' line: 'calibre_installed: True' - state: present diff --git a/roles/captiveportal/tasks/main.yml b/roles/captiveportal/tasks/main.yml index 3b0c34fed..eb7b26363 100644 --- a/roles/captiveportal/tasks/main.yml +++ b/roles/captiveportal/tasks/main.yml @@ -93,7 +93,6 @@ dest: "{{ iiab_state_file }}" regexp: '^captiveportal_installed' line: 'captiveportal_installed: True' - state: present #- name: Restart dnsmasq # systemd: @@ -114,4 +113,3 @@ name: dnsmasq state: started when: dnsmasq_enabled | bool - diff --git a/roles/cups/tasks/main.yml b/roles/cups/tasks/main.yml index 0d035f802..e2455c526 100644 --- a/roles/cups/tasks/main.yml +++ b/roles/cups/tasks/main.yml @@ -7,13 +7,6 @@ tags: - download -- name: "Add 'cups_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml - lineinfile: - dest: "{{ iiab_state_file }}" - regexp: '^cups_installed' - line: 'cups_installed: True' - state: present - - name: Install our own /etc/cups/cupsd.conf from template, to permit local LAN admin template: src: cupsd.conf @@ -24,12 +17,15 @@ src: cups.conf dest: "/etc/{{ apache_config_dir }}/" -- name: Create symlink cups.conf from sites-enabled to sites-available (debuntu) - file: - src: /etc/apache2/sites-available/cups.conf - dest: /etc/apache2/sites-enabled/cups.conf - state: link - when: cups_enabled and is_debuntu +- name: "Add 'cups_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + lineinfile: + dest: "{{ iiab_state_file }}" + regexp: '^cups_installed' + line: 'cups_installed: True' + +- name: Enable http://box/cups via Apache (MIGHT NOT WORK?) + command: a2ensite cups.conf + when: cups_enabled - name: Enable & Start services 'cups' and 'cups-browsed' (OS's other than Fedora 18) service: diff --git a/roles/gitea/tasks/install.yml b/roles/gitea/tasks/install.yml index 90a99b8cc..2ef2f42a9 100644 --- a/roles/gitea/tasks/install.yml +++ b/roles/gitea/tasks/install.yml @@ -129,4 +129,3 @@ dest: "{{ iiab_state_file }}" regexp: '^gitea_installed' line: 'gitea_installed: True' - state: present diff --git a/roles/httpd/tasks/install.yml b/roles/httpd/tasks/install.yml index c0f9300d2..72ba22696 100644 --- a/roles/httpd/tasks/install.yml +++ b/roles/httpd/tasks/install.yml @@ -107,9 +107,9 @@ - name: Create Apache's pid dir /var/run/{{ apache_user }} file: path: "/var/run/{{ apache_user }}" - mode: 0755 owner: root group: root + mode: '0755' state: directory - name: 'Create group: admin' @@ -127,9 +127,9 @@ - name: Create Apache dir /var/log/{{ apache_service }} file: path: "/var/log/{{ apache_service }}" - mode: 0755 owner: "{{ apache_user }}" group: "{{ apache_user }}" + mode: '0755' state: directory - name: Enable Apache systemd service ({{ apache_service }}) @@ -141,7 +141,13 @@ - name: Create /library/www/html/info directory for http://box/info offline docs file: path: "{{ doc_root }}/info" - mode: 0755 owner: "{{ apache_user }}" group: "{{ apache_user }}" + mode: '0755' state: directory + +- name: "Add 'apache_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + lineinfile: + dest: "{{ iiab_state_file }}" + regexp: '^apache_installed' + line: 'apache_installed: True' diff --git a/roles/internetarchive/tasks/install.yml b/roles/internetarchive/tasks/install.yml index 97e42e6eb..d1b6f70f9 100644 --- a/roles/internetarchive/tasks/install.yml +++ b/roles/internetarchive/tasks/install.yml @@ -50,4 +50,3 @@ dest: "{{ iiab_state_file }}" regexp: '^internetarchive_installed' line: 'internetarchive_installed: True' - state: present diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index c5b46f402..941573a4a 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -81,3 +81,10 @@ path: /usr/local/kalite/venv/local/lib/python2.7/site-packages/kalite/packages/dist/ifcfg/parser.py regexp: 'a-zA-Z0-9' replace: 'a-zA-Z0-9\-' + +# SHOULD REALLY BE HERE...but for now this runs in kalite/tasks/setup.yml +# - name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +# lineinfile: +# dest: "{{ iiab_state_file }}" +# regexp: '^kalite_installed' +# line: 'kalite_installed: True' diff --git a/roles/kalite/tasks/setup.yml b/roles/kalite/tasks/setup.yml index 6807a79b1..36105a7d8 100644 --- a/roles/kalite/tasks/setup.yml +++ b/roles/kalite/tasks/setup.yml @@ -3,9 +3,9 @@ - name: Create {{ kalite_root }} directory file: path: "{{ kalite_root }}/httpsrv/static" # /library/ka-lite - owner: root - group: root - mode: 0755 + # owner: root + # group: root + # mode: 0755 state: directory - name: Run the setup using 'kalite manage' @@ -15,9 +15,9 @@ async: 1800 poll: 10 +# CAN WE MOVE THIS TO THE END OF kalite/tasks/install.yml (HENCE ITS FILENAME!) - name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^kalite_installed' line: 'kalite_installed: True' - state: present diff --git a/roles/kiwix/tasks/install.yml b/roles/kiwix/tasks/install.yml index 60ecd1a95..24e785b21 100644 --- a/roles/kiwix/tasks/install.yml +++ b/roles/kiwix/tasks/install.yml @@ -88,4 +88,3 @@ dest: "{{ iiab_state_file }}" regexp: '^kiwix_installed' line: 'kiwix_installed: True' - state: present diff --git a/roles/kolibri/tasks/install.yml b/roles/kolibri/tasks/install.yml index d2f40ddab..8070266ac 100644 --- a/roles/kolibri/tasks/install.yml +++ b/roles/kolibri/tasks/install.yml @@ -118,4 +118,3 @@ dest: "{{ iiab_state_file }}" regexp: '^kolibri_installed' line: 'kolibri_installed: True' - state: present diff --git a/roles/mediawiki/tasks/install.yml b/roles/mediawiki/tasks/install.yml index 4e4aed023..73fd1e2ba 100644 --- a/roles/mediawiki/tasks/install.yml +++ b/roles/mediawiki/tasks/install.yml @@ -90,4 +90,3 @@ dest: "{{ iiab_state_file }}" regexp: '^mediawiki_installed' line: 'mediawiki_installed: True' - state: present diff --git a/roles/minetest/tasks/provision.yml b/roles/minetest/tasks/provision.yml index 86241b18e..4d81c74b9 100644 --- a/roles/minetest/tasks/provision.yml +++ b/roles/minetest/tasks/provision.yml @@ -9,12 +9,10 @@ - name: Create /library/games file: state: directory - path: "{{ item }}" - owner: root - group: root - mode: 0755 - with_items: - - /library/games + path: /library/games + # owner: root + # group: root + # mode: 0755 # rpi only - include_tasks: rpi_minetest_install.yml @@ -37,7 +35,7 @@ recurse: yes owner: "{{ minetest_runas_user }}" group: "{{ minetest_runas_group }}" - mode: 0755 + # mode: 0755 when: minetest_default_game == "carbone-ng" # Install games @@ -76,5 +74,3 @@ dest: "{{ iiab_state_file }}" regexp: '^minetest_installed' line: 'minetest_installed: True' - state: present - diff --git a/roles/mongodb/tasks/install.yml b/roles/mongodb/tasks/install.yml index 0708e78a6..cd04bf856 100644 --- a/roles/mongodb/tasks/install.yml +++ b/roles/mongodb/tasks/install.yml @@ -133,4 +133,3 @@ dest: "{{ iiab_state_file }}" regexp: '^mongodb_installed' line: 'mongodb_installed: True' - state: present diff --git a/roles/monit/tasks/install.yml b/roles/monit/tasks/install.yml index c671161ae..384a4e943 100644 --- a/roles/monit/tasks/install.yml +++ b/roles/monit/tasks/install.yml @@ -57,3 +57,9 @@ value: '"Monit is a background service monitor which can correct problems, send email, restart services."' - option: enabled value: "{{ monit_enabled }}" + +- name: "Add 'monit_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + lineinfile: + dest: "{{ iiab_state_file }}" + regexp: '^monit_installed' + line: 'monit_installed: True' diff --git a/roles/mosquitto/tasks/install.yml b/roles/mosquitto/tasks/install.yml index 5638a52f2..c45307535 100644 --- a/roles/mosquitto/tasks/install.yml +++ b/roles/mosquitto/tasks/install.yml @@ -35,4 +35,3 @@ dest: "{{ iiab_state_file }}" regexp: '^mosquitto_installed' line: 'mosquitto_installed: True' - state: present diff --git a/roles/munin/tasks/install.yml b/roles/munin/tasks/install.yml index 36b52e00b..25ba14b80 100644 --- a/roles/munin/tasks/install.yml +++ b/roles/munin/tasks/install.yml @@ -45,4 +45,3 @@ dest: "{{ iiab_state_file }}" regexp: '^munin_installed' line: 'munin_installed: True' - state: present diff --git a/roles/network/tasks/dansguardian.yml b/roles/network/tasks/dansguardian.yml index a198b79b0..553f951fb 100644 --- a/roles/network/tasks/dansguardian.yml +++ b/roles/network/tasks/dansguardian.yml @@ -11,7 +11,7 @@ dest: /etc/dansguardian/dansguardian.conf owner: dansguardian group: dansguardian - mode: 0640 + mode: '0640' when: ansible_distribution == "Fedora" - name: Install /etc/dansguardian/dansguardian.conf from template (debuntu) @@ -20,7 +20,7 @@ dest: /etc/dansguardian/dansguardian.conf owner: dansguardian group: dansguardian - mode: 0640 + mode: '0640' when: is_debuntu | bool - name: Install /etc/dansguardian/dansguardian.conf from template (CentOS) @@ -29,7 +29,7 @@ dest: /etc/dansguardian/dansguardian.conf owner: dansguardian group: vscan - mode: 0640 + mode: '0640' when: ansible_distribution == "CentOS" - name: Create directory /var/log/dansguardian (OS's other than CentOS) @@ -37,7 +37,7 @@ path: /var/log/dansguardian owner: dansguardian group: dansguardian - mode: 0750 + mode: '0750' state: directory when: ansible_distribution != "CentOS" @@ -46,7 +46,7 @@ path: /var/log/dansguardian owner: dansguardian group: vscan - mode: 0750 + mode: '0750' state: directory when: ansible_distribution == "CentOS" @@ -55,4 +55,3 @@ dest: "{{ iiab_state_file }}" regexp: '^dansguardian_installed' line: 'dansguardian_installed: True' - state: present diff --git a/roles/network/tasks/dhcpd.yml b/roles/network/tasks/dhcpd.yml index 7ac500af0..af989e4b2 100644 --- a/roles/network/tasks/dhcpd.yml +++ b/roles/network/tasks/dhcpd.yml @@ -3,16 +3,12 @@ name: isc-dhcp-server state: present when: is_debuntu | bool - tags: - - download - name: Install dhcp package (not debuntu) package: name: dhcp state: present when: not is_debuntu - tags: - - download - name: Create non-privileged user 'dhcpd' (debuntu) user: @@ -37,13 +33,11 @@ - name: Install systemd unit file to /etc/systemd/system/dhcpd.service template: - src: "{{ item.src }}" - dest: "{{ item.dest }}" - owner: root - group: root - mode: "{{ item.mode }}" - with_items: - - { src: 'roles/network/templates/dhcp/dhcpd.service', dest: '/etc/systemd/system/dhcpd.service', mode: '0644' } + src: roles/network/templates/dhcp/dhcpd.service + dest: /etc/systemd/system/dhcpd.service + # owner: root + # group: root + # mode: '0644' - name: Create file /var/lib/dhcpd/dhcpd.leases (redhat) command: touch /var/lib/dhcpd/dhcpd.leases @@ -56,8 +50,8 @@ path: /var/lib/dhcpd/dhcpd.leases owner: dhcpd group: dhcpd - mode: 0644 - state: file + mode: '0644' + # state: file when: is_redhat | bool - name: "Add 'dhcpd_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml @@ -65,4 +59,3 @@ dest: "{{ iiab_state_file }}" regexp: '^dhcpd_installed' line: 'dhcpd_installed: True' - state: present diff --git a/roles/network/tasks/named.yml b/roles/network/tasks/named.yml index 4718e4ecd..886cdf0c7 100644 --- a/roles/network/tasks/named.yml +++ b/roles/network/tasks/named.yml @@ -5,8 +5,6 @@ - bind9utils state: present when: is_debuntu | bool - tags: - - download - name: "Install named packages: bind, bind-utils (OS's other than debuntu)" package: @@ -15,8 +13,6 @@ - bind-utils state: present when: not is_debuntu - tags: - - download # or we have to change the serial number in the config files. - name: Stop named before copying files (if first_run and debuntu) @@ -30,7 +26,7 @@ path: "{{ item }}" owner: "{{ dns_user }}" group: root - mode: 0755 + mode: '0755' state: directory with_items: - /var/named-iiab @@ -72,7 +68,7 @@ template: src: "roles/network/templates/named/{{ dns_service }}.service" dest: "/etc/systemd/system/{{ dns_service }}.service" - mode: 0644 + mode: '0644' - name: "Install /etc/{{ apache_config_dir }}/dns-jail.conf from template: dns-jail redirect requires the named.blackhole, disabling recursion (if dns_jail_enabled)" # in named-iiab.conf, and the redirection of 404 error documents to / @@ -81,31 +77,19 @@ dest: "/etc/{{ apache_config_dir }}/" when: dns_jail_enabled | bool -- name: Create symlink dns-jail.conf from sites-enabled to sites-available (if debuntu and dns_jail_enabled) - file: - src: "/etc/{{ apache_config_dir }}/dns-jail.conf" - path: "/etc/{{ apache_service }}/sites-enabled/dns-jail.conf" - state: link - when: is_debuntu and dns_jail_enabled - -- name: Remove symlink /etc/{{ apache_service }}/sites-enabled/dns-jail.conf (if debuntu and not dns_jail_enabled) - file: - path: "/etc/{{ apache_service }}/sites-enabled/dns-jail.conf" - state: absent - when: is_debuntu and not dns_jail_enabled - -- name: Remove symlink /etc/{{ apache_config_dir }}/dns-jail.conf (if not debuntu and not dns_jail_enabled) - file: - path: "/etc/{{ apache_config_dir }}/dns-jail.conf" - state: absent - when: not is_debuntu and not dns_jail_enabled - - name: "Add 'named_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml lineinfile: dest: "{{ iiab_state_file }}" regexp: '^named_installed' line: 'named_installed: True' - state: present + +- name: Enable dns-jail.conf via Apache + command: a2ensite dns-jail.conf + when: dns_jail_enabled | bool + +- name: Disable dns-jail.conf via Apache + command: a2dissite: dns-jail.conf + when: not dns_jail_enabled - name: Start named systemd service systemd: diff --git a/roles/network/tasks/squid.yml b/roles/network/tasks/squid.yml index fd798977e..5aa5d906a 100644 --- a/roles/network/tasks/squid.yml +++ b/roles/network/tasks/squid.yml @@ -4,8 +4,6 @@ - "{{ proxy }}" - cadaver state: present - tags: - - download - name: "Bigger hammer for Ubuntu, run: /etc/init.d/squid stop" command: /etc/init.d/squid stop @@ -68,7 +66,7 @@ path: /library/cache owner: "{{ proxy_user }}" group: "{{ proxy_user }}" - mode: 0750 + mode: '0750' state: directory - name: Create Squid directory /var/log/{{ proxy }} @@ -76,7 +74,7 @@ path: "/var/log/{{ proxy }}" owner: "{{ proxy_user }}" group: "{{ proxy_user }}" - mode: 0750 + mode: '0750' state: directory - include_tasks: roles/network/tasks/dansguardian.yml @@ -87,7 +85,6 @@ dest: "{{ iiab_state_file }}" regexp: '^squid_installed' line: 'squid_installed: True' - state: present # {{ proxy }} is normally "squid", but is "squid3" on raspbian-8 & debian-8 - name: Add '{{ proxy }}' variable values to {{ iiab_ini_file }} diff --git a/roles/network/tasks/wondershaper.yml b/roles/network/tasks/wondershaper.yml index 8a61fd578..e4e39c8fa 100644 --- a/roles/network/tasks/wondershaper.yml +++ b/roles/network/tasks/wondershaper.yml @@ -3,39 +3,39 @@ backup: yes src: roles/network/templates/wondershaper/wondershaper.service dest: /etc/systemd/system/wondershaper.service - mode: 0644 + # mode: '0644' - name: Install /usr/bin/wondershaper from template template: backup: yes src: roles/network/templates/wondershaper/wondershaper.j2 dest: /usr/bin/wondershaper - owner: root - group: root - mode: 0744 + # owner: root + # group: root + # mode: '0744' - name: Create conf.d directory file: path: /etc/conf.d - owner: root - group: root - mode: 0755 + # owner: root + # group: root + # mode: '0755' state: directory - name: Install /etc/conf.d/wondershaper.conf from template template: src: roles/network/templates/wondershaper/wondershaper.conf dest: /etc/conf.d/wondershaper.conf - owner: root - group: root - mode: 0600 + # owner: root + # group: root + mode: '0600' -- name: Create fact (link) for /etc/conf.d/wondershaper.conf +- name: Create fact (symlink) /etc/ansible/facts.d/wondershaper.fact -> /etc/conf.d/wondershaper.conf file: src: /etc/conf.d/wondershaper.conf dest: /etc/ansible/facts.d/wondershaper.fact - owner: root - group: root + # owner: root + # group: root state: link - name: "Add 'wondershaper_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml @@ -43,7 +43,6 @@ dest: "{{ iiab_state_file }}" regexp: '^wondershaper_installed' line: 'wondershaper_installed: True' - state: present - name: Add 'wondershaper' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/nginx/tasks/install.yml b/roles/nginx/tasks/install.yml index e3198509f..abf17c969 100644 --- a/roles/nginx/tasks/install.yml +++ b/roles/nginx/tasks/install.yml @@ -34,3 +34,9 @@ path: /var/log/uwsgi/app state: directory owner: "{{ apache_user }}" + +- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + lineinfile: + dest: "{{ iiab_state_file }}" + regexp: '^nginx_installed' + line: 'nginx_installed: True' diff --git a/roles/samba/tasks/main.yml b/roles/samba/tasks/main.yml index 33e07b817..b46ace141 100755 --- a/roles/samba/tasks/main.yml +++ b/roles/samba/tasks/main.yml @@ -35,7 +35,6 @@ dest: "{{ iiab_state_file }}" regexp: '^samba_installed' line: 'samba_installed: True' - state: present - name: Enable & Start Samba systemd service service: diff --git a/roles/sugarizer/tasks/install.yml b/roles/sugarizer/tasks/install.yml index 9ebfbb1ec..b708cbc4e 100644 --- a/roles/sugarizer/tasks/install.yml +++ b/roles/sugarizer/tasks/install.yml @@ -220,4 +220,3 @@ dest: "{{ iiab_state_file }}" regexp: '^sugarizer_installed' line: 'sugarizer_installed: True' - state: present diff --git a/roles/teamviewer/tasks/install.yml b/roles/teamviewer/tasks/install.yml index 95ae6b975..ada106a9c 100644 --- a/roles/teamviewer/tasks/install.yml +++ b/roles/teamviewer/tasks/install.yml @@ -49,3 +49,9 @@ with_items: - teamviewer* when: teamviewer_install and xo_model == "none" and ansible_distribution_version >= "22" + +- name: "Add 'teamviewer_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + lineinfile: + dest: "{{ iiab_state_file }}" + regexp: '^teamviewer_installed' + line: 'teamviewer_installed: True' diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 096b927b2..6cb4a9e88 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -95,4 +95,3 @@ dest: "{{ iiab_state_file }}" regexp: '^wordpress_installed' line: 'wordpress_installed: True' - state: present From c53fc6fc9a34c50b5e339764f6e348336c5515ad Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 17:21:56 -0500 Subject: [PATCH 16/19] Clean wondershaper.yml, nginx/tasks/main.yml --- roles/network/tasks/wondershaper.yml | 2 +- roles/nginx/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/network/tasks/wondershaper.yml b/roles/network/tasks/wondershaper.yml index e4e39c8fa..bc3f9f766 100644 --- a/roles/network/tasks/wondershaper.yml +++ b/roles/network/tasks/wondershaper.yml @@ -12,7 +12,7 @@ dest: /usr/bin/wondershaper # owner: root # group: root - # mode: '0744' + mode: '0744' - name: Create conf.d directory file: diff --git a/roles/nginx/tasks/main.yml b/roles/nginx/tasks/main.yml index 1331301de..111ea31d2 100644 --- a/roles/nginx/tasks/main.yml +++ b/roles/nginx/tasks/main.yml @@ -35,7 +35,7 @@ # include_tasks: only_nginx.yml # when: nginx_enabled | bool -- name: Stop and disable NGINX, when not nginx_enabled +- name: Stop & Disable 'nginx' systemd service, when not nginx_enabled systemd: name: nginx state: stopped From a4d898dd9c797c37a889bb08d007321281b76a34 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 18:15:33 -0500 Subject: [PATCH 17/19] Cleaner ver: 35+1 files may write to iiab_state.yml --- roles/awstats/tasks/install.yml | 4 ++-- roles/azuracast/tasks/install.yml | 4 ++-- roles/bluetooth/tasks/install.yml | 4 ++-- roles/calibre-web/tasks/install.yml | 4 ++-- roles/calibre/tasks/install.yml | 4 ++-- roles/captiveportal/tasks/main.yml | 4 ++-- roles/cups/tasks/main.yml | 4 ++-- roles/dokuwiki/tasks/install.yml | 4 ++-- roles/elgg/tasks/install.yml | 4 ++-- roles/gitea/tasks/install.yml | 4 ++-- roles/httpd/tasks/install.yml | 4 ++-- roles/internetarchive/tasks/install.yml | 4 ++-- roles/kalite/tasks/install.yml | 4 ++-- roles/kalite/tasks/setup.yml | 4 ++-- roles/kiwix/tasks/install.yml | 4 ++-- roles/kolibri/tasks/install.yml | 4 ++-- roles/lokole/tasks/install.yml | 4 ++-- roles/mediawiki/tasks/install.yml | 4 ++-- roles/minetest/tasks/provision.yml | 4 ++-- roles/mongodb/tasks/install.yml | 4 ++-- roles/monit/tasks/install.yml | 4 ++-- roles/moodle/tasks/install.yml | 4 ++-- roles/mosquitto/tasks/install.yml | 4 ++-- roles/munin/tasks/install.yml | 4 ++-- roles/network/tasks/dansguardian.yml | 4 ++-- roles/network/tasks/dhcpd.yml | 4 ++-- roles/network/tasks/named.yml | 4 ++-- roles/network/tasks/squid.yml | 4 ++-- roles/network/tasks/wondershaper.yml | 4 ++-- roles/nextcloud/tasks/install.yml | 4 ++-- roles/nginx/tasks/install.yml | 4 ++-- roles/nodered/tasks/install.yml | 4 ++-- roles/samba/tasks/main.yml | 4 ++-- roles/sugarizer/tasks/install.yml | 4 ++-- roles/teamviewer/tasks/install.yml | 4 ++-- roles/wordpress/tasks/install.yml | 4 ++-- 36 files changed, 72 insertions(+), 72 deletions(-) diff --git a/roles/awstats/tasks/install.yml b/roles/awstats/tasks/install.yml index e4fa353a4..e2958907d 100644 --- a/roles/awstats/tasks/install.yml +++ b/roles/awstats/tasks/install.yml @@ -76,8 +76,8 @@ shell: /usr/bin/perl /usr/lib/cgi-bin/awstats.pl -config=schoolserver -update # when: awstats_enabled | bool -- name: "Add 'awstats_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'awstats_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^awstats_installed' line: 'awstats_installed: True' diff --git a/roles/azuracast/tasks/install.yml b/roles/azuracast/tasks/install.yml index 6014a0dc1..6cc0ed331 100644 --- a/roles/azuracast/tasks/install.yml +++ b/roles/azuracast/tasks/install.yml @@ -64,8 +64,8 @@ args: chdir: "{{ azuracast_host_dir }}" -- name: "Add 'azuracast_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'azuracast_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^azuracast_installed' line: 'azuracast_installed: True' diff --git a/roles/bluetooth/tasks/install.yml b/roles/bluetooth/tasks/install.yml index b127a9455..30aca6282 100644 --- a/roles/bluetooth/tasks/install.yml +++ b/roles/bluetooth/tasks/install.yml @@ -55,8 +55,8 @@ regexp: '^#DiscoverableTimeout' line: 'DiscoverableTimeout = 0' -- name: "Add 'bluetooth_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'bluetooth_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^bluetooth_installed' line: 'bluetooth_installed: True' diff --git a/roles/calibre-web/tasks/install.yml b/roles/calibre-web/tasks/install.yml index 242e0fd3a..a71fe04c0 100644 --- a/roles/calibre-web/tasks/install.yml +++ b/roles/calibre-web/tasks/install.yml @@ -102,8 +102,8 @@ when: not metadatadb.stat.exists #when: calibreweb_provision | bool -- name: "Add 'calibreweb_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'calibreweb_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^calibreweb_installed' line: 'calibreweb_installed: True' diff --git a/roles/calibre/tasks/install.yml b/roles/calibre/tasks/install.yml index a8a3ff269..93f9df09a 100644 --- a/roles/calibre/tasks/install.yml +++ b/roles/calibre/tasks/install.yml @@ -79,8 +79,8 @@ include_tasks: create-db.yml when: not calibre_db.stat.exists -- name: "Add 'calibre_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'calibre_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^calibre_installed' line: 'calibre_installed: True' diff --git a/roles/captiveportal/tasks/main.yml b/roles/captiveportal/tasks/main.yml index eb7b26363..cfc965005 100644 --- a/roles/captiveportal/tasks/main.yml +++ b/roles/captiveportal/tasks/main.yml @@ -88,9 +88,9 @@ state: absent when: not captiveportal_enabled -- name: "Add 'captiveportal_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'captiveportal_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^captiveportal_installed' line: 'captiveportal_installed: True' diff --git a/roles/cups/tasks/main.yml b/roles/cups/tasks/main.yml index e2455c526..03b6b5edf 100644 --- a/roles/cups/tasks/main.yml +++ b/roles/cups/tasks/main.yml @@ -17,9 +17,9 @@ src: cups.conf dest: "/etc/{{ apache_config_dir }}/" -- name: "Add 'cups_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'cups_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^cups_installed' line: 'cups_installed: True' diff --git a/roles/dokuwiki/tasks/install.yml b/roles/dokuwiki/tasks/install.yml index 2477fe5ee..22ef5318b 100644 --- a/roles/dokuwiki/tasks/install.yml +++ b/roles/dokuwiki/tasks/install.yml @@ -47,8 +47,8 @@ # state: absent # when: not dokuwiki_enabled and is_debuntu -- name: "Add 'dokuwiki_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'dokuwiki_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^dokuwiki_installed' line: 'dokuwiki_installed: True' diff --git a/roles/elgg/tasks/install.yml b/roles/elgg/tasks/install.yml index f2b90c8dd..0ab9a7a04 100644 --- a/roles/elgg/tasks/install.yml +++ b/roles/elgg/tasks/install.yml @@ -87,8 +87,8 @@ src: elgg.conf dest: "/etc/{{ apache_config_dir }}/elgg.conf" -- name: "Add 'elgg_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'elgg_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^elgg_installed' line: 'elgg_installed: True' diff --git a/roles/gitea/tasks/install.yml b/roles/gitea/tasks/install.yml index 2ef2f42a9..66d08e5a5 100644 --- a/roles/gitea/tasks/install.yml +++ b/roles/gitea/tasks/install.yml @@ -124,8 +124,8 @@ - { src: 'gitea.service.j2', dest: '/etc/systemd/system/gitea.service' } - { src: 'gitea.conf.j2', dest: "/etc/{{ apache_config_dir }}/gitea.conf" } -- name: "Add 'gitea_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'gitea_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^gitea_installed' line: 'gitea_installed: True' diff --git a/roles/httpd/tasks/install.yml b/roles/httpd/tasks/install.yml index 72ba22696..16b1afb94 100644 --- a/roles/httpd/tasks/install.yml +++ b/roles/httpd/tasks/install.yml @@ -146,8 +146,8 @@ mode: '0755' state: directory -- name: "Add 'apache_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'apache_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^apache_installed' line: 'apache_installed: True' diff --git a/roles/internetarchive/tasks/install.yml b/roles/internetarchive/tasks/install.yml index d1b6f70f9..9295c4a86 100644 --- a/roles/internetarchive/tasks/install.yml +++ b/roles/internetarchive/tasks/install.yml @@ -45,8 +45,8 @@ - { src: 'internetarchive.service.j2', dest: '/etc/systemd/system/internetarchive.service' } - { src: 'internetarchive.conf', dest: '/etc/apache2/sites-available/internetarchive.conf' } -- name: "Add 'internetarchive_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'internetarchive_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^internetarchive_installed' line: 'internetarchive_installed: True' diff --git a/roles/kalite/tasks/install.yml b/roles/kalite/tasks/install.yml index 941573a4a..78cfbb264 100644 --- a/roles/kalite/tasks/install.yml +++ b/roles/kalite/tasks/install.yml @@ -83,8 +83,8 @@ replace: 'a-zA-Z0-9\-' # SHOULD REALLY BE HERE...but for now this runs in kalite/tasks/setup.yml -# - name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +# - name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" # lineinfile: -# dest: "{{ iiab_state_file }}" +# dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml # regexp: '^kalite_installed' # line: 'kalite_installed: True' diff --git a/roles/kalite/tasks/setup.yml b/roles/kalite/tasks/setup.yml index 36105a7d8..9f52ace5e 100644 --- a/roles/kalite/tasks/setup.yml +++ b/roles/kalite/tasks/setup.yml @@ -16,8 +16,8 @@ poll: 10 # CAN WE MOVE THIS TO THE END OF kalite/tasks/install.yml (HENCE ITS FILENAME!) -- name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'kalite_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^kalite_installed' line: 'kalite_installed: True' diff --git a/roles/kiwix/tasks/install.yml b/roles/kiwix/tasks/install.yml index 24e785b21..4b8d65386 100644 --- a/roles/kiwix/tasks/install.yml +++ b/roles/kiwix/tasks/install.yml @@ -83,8 +83,8 @@ # 5. RECORD KIWIX AS INSTALLED IN /etc/iiab/iiab_state.yml -- name: "Add 'kiwix_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'kiwix_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^kiwix_installed' line: 'kiwix_installed: True' diff --git a/roles/kolibri/tasks/install.yml b/roles/kolibri/tasks/install.yml index 8070266ac..134945287 100644 --- a/roles/kolibri/tasks/install.yml +++ b/roles/kolibri/tasks/install.yml @@ -113,8 +113,8 @@ # apache2_module: # name: proxy_http -- name: "Add 'kolibri_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'kolibri_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^kolibri_installed' line: 'kolibri_installed: True' diff --git a/roles/lokole/tasks/install.yml b/roles/lokole/tasks/install.yml index e7c42a340..2b798bd37 100644 --- a/roles/lokole/tasks/install.yml +++ b/roles/lokole/tasks/install.yml @@ -86,8 +86,8 @@ # state: restarted # when: lokole_enabled | bool -- name: "Add 'lokole_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'lokole_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^lokole_installed' line: 'lokole_installed: True' diff --git a/roles/mediawiki/tasks/install.yml b/roles/mediawiki/tasks/install.yml index 73fd1e2ba..07d216602 100644 --- a/roles/mediawiki/tasks/install.yml +++ b/roles/mediawiki/tasks/install.yml @@ -85,8 +85,8 @@ # Install {{ nginx_config_dir }}/mediawiki-nginx.conf from template in enable.yml -- name: "Add 'mediawiki_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'mediawiki_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^mediawiki_installed' line: 'mediawiki_installed: True' diff --git a/roles/minetest/tasks/provision.yml b/roles/minetest/tasks/provision.yml index 4d81c74b9..4dde9bb20 100644 --- a/roles/minetest/tasks/provision.yml +++ b/roles/minetest/tasks/provision.yml @@ -69,8 +69,8 @@ path: "{{ minetest_game_dir }}/mods/name_restrictions" when: minetest_default_game == "carbone-ng" -- name: "Add 'minetest_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'minetest_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^minetest_installed' line: 'minetest_installed: True' diff --git a/roles/mongodb/tasks/install.yml b/roles/mongodb/tasks/install.yml index cd04bf856..a7959ce66 100644 --- a/roles/mongodb/tasks/install.yml +++ b/roles/mongodb/tasks/install.yml @@ -128,8 +128,8 @@ - { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' } - { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' } -- name: "Add 'mongodb_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'mongodb_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^mongodb_installed' line: 'mongodb_installed: True' diff --git a/roles/monit/tasks/install.yml b/roles/monit/tasks/install.yml index 384a4e943..42a9e396f 100644 --- a/roles/monit/tasks/install.yml +++ b/roles/monit/tasks/install.yml @@ -58,8 +58,8 @@ - option: enabled value: "{{ monit_enabled }}" -- name: "Add 'monit_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'monit_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^monit_installed' line: 'monit_installed: True' diff --git a/roles/moodle/tasks/install.yml b/roles/moodle/tasks/install.yml index 2b93d6b7b..059c56d42 100644 --- a/roles/moodle/tasks/install.yml +++ b/roles/moodle/tasks/install.yml @@ -138,8 +138,8 @@ path: "{{ moodle_base }}/config.php" mode: '0644' -- name: "Add 'moodle_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'moodle_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^moodle_installed' line: 'moodle_installed: True' diff --git a/roles/mosquitto/tasks/install.yml b/roles/mosquitto/tasks/install.yml index c45307535..890b4ec15 100644 --- a/roles/mosquitto/tasks/install.yml +++ b/roles/mosquitto/tasks/install.yml @@ -30,8 +30,8 @@ group: root mode: 0755 -- name: "Add 'mosquitto_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'mosquitto_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^mosquitto_installed' line: 'mosquitto_installed: True' diff --git a/roles/munin/tasks/install.yml b/roles/munin/tasks/install.yml index 25ba14b80..5f228618d 100644 --- a/roles/munin/tasks/install.yml +++ b/roles/munin/tasks/install.yml @@ -40,8 +40,8 @@ create: yes state: present -- name: "Add 'munin_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'munin_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^munin_installed' line: 'munin_installed: True' diff --git a/roles/network/tasks/dansguardian.yml b/roles/network/tasks/dansguardian.yml index 553f951fb..7c303d695 100644 --- a/roles/network/tasks/dansguardian.yml +++ b/roles/network/tasks/dansguardian.yml @@ -50,8 +50,8 @@ state: directory when: ansible_distribution == "CentOS" -- name: "Add 'dansguardian_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'dansguardian_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^dansguardian_installed' line: 'dansguardian_installed: True' diff --git a/roles/network/tasks/dhcpd.yml b/roles/network/tasks/dhcpd.yml index af989e4b2..054db6ee5 100644 --- a/roles/network/tasks/dhcpd.yml +++ b/roles/network/tasks/dhcpd.yml @@ -54,8 +54,8 @@ # state: file when: is_redhat | bool -- name: "Add 'dhcpd_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'dhcpd_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^dhcpd_installed' line: 'dhcpd_installed: True' diff --git a/roles/network/tasks/named.yml b/roles/network/tasks/named.yml index 886cdf0c7..125300dad 100644 --- a/roles/network/tasks/named.yml +++ b/roles/network/tasks/named.yml @@ -77,9 +77,9 @@ dest: "/etc/{{ apache_config_dir }}/" when: dns_jail_enabled | bool -- name: "Add 'named_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'named_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^named_installed' line: 'named_installed: True' diff --git a/roles/network/tasks/squid.yml b/roles/network/tasks/squid.yml index 5aa5d906a..55f8ad0a9 100644 --- a/roles/network/tasks/squid.yml +++ b/roles/network/tasks/squid.yml @@ -80,9 +80,9 @@ - include_tasks: roles/network/tasks/dansguardian.yml when: dansguardian_install | bool -- name: "Add 'squid_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'squid_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^squid_installed' line: 'squid_installed: True' diff --git a/roles/network/tasks/wondershaper.yml b/roles/network/tasks/wondershaper.yml index bc3f9f766..d55481471 100644 --- a/roles/network/tasks/wondershaper.yml +++ b/roles/network/tasks/wondershaper.yml @@ -38,9 +38,9 @@ # group: root state: link -- name: "Add 'wondershaper_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'wondershaper_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^wondershaper_installed' line: 'wondershaper_installed: True' diff --git a/roles/nextcloud/tasks/install.yml b/roles/nextcloud/tasks/install.yml index ca45f96d3..188a343ef 100644 --- a/roles/nextcloud/tasks/install.yml +++ b/roles/nextcloud/tasks/install.yml @@ -175,8 +175,8 @@ src: nextcloud.conf.j2 dest: "/etc/{{ apache_config_dir }}/nextcloud.conf" -- name: "Add 'nextcloud_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'nextcloud_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^nextcloud_installed' line: 'nextcloud_installed: True' diff --git a/roles/nginx/tasks/install.yml b/roles/nginx/tasks/install.yml index abf17c969..046145467 100644 --- a/roles/nginx/tasks/install.yml +++ b/roles/nginx/tasks/install.yml @@ -35,8 +35,8 @@ state: directory owner: "{{ apache_user }}" -- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^nginx_installed' line: 'nginx_installed: True' diff --git a/roles/nodered/tasks/install.yml b/roles/nodered/tasks/install.yml index fb92b7c5e..ceeb04eb5 100644 --- a/roles/nodered/tasks/install.yml +++ b/roles/nodered/tasks/install.yml @@ -93,8 +93,8 @@ state: present name: proxy_wstunnel -- name: "Add 'nodered_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'nodered_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^nodered_installed' line: 'nodered_installed: True' diff --git a/roles/samba/tasks/main.yml b/roles/samba/tasks/main.yml index b46ace141..05995fe18 100755 --- a/roles/samba/tasks/main.yml +++ b/roles/samba/tasks/main.yml @@ -30,9 +30,9 @@ src: smb.conf.j2 dest: /etc/samba/smb.conf -- name: "Add 'samba_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'samba_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^samba_installed' line: 'samba_installed: True' diff --git a/roles/sugarizer/tasks/install.yml b/roles/sugarizer/tasks/install.yml index b708cbc4e..1c4f36e3f 100644 --- a/roles/sugarizer/tasks/install.yml +++ b/roles/sugarizer/tasks/install.yml @@ -215,8 +215,8 @@ # # Use this instead, if tabs are truly nec: # # block: "\tvar pathPrefix = '/sugarizer';\n\tapp.use(pathPrefix, require('path-prefix-proxy')(pathPrefix));" -- name: "Add 'sugarizer_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'sugarizer_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^sugarizer_installed' line: 'sugarizer_installed: True' diff --git a/roles/teamviewer/tasks/install.yml b/roles/teamviewer/tasks/install.yml index ada106a9c..9f5ae1ad2 100644 --- a/roles/teamviewer/tasks/install.yml +++ b/roles/teamviewer/tasks/install.yml @@ -50,8 +50,8 @@ - teamviewer* when: teamviewer_install and xo_model == "none" and ansible_distribution_version >= "22" -- name: "Add 'teamviewer_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'teamviewer_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^teamviewer_installed' line: 'teamviewer_installed: True' diff --git a/roles/wordpress/tasks/install.yml b/roles/wordpress/tasks/install.yml index 6cb4a9e88..d974a401d 100644 --- a/roles/wordpress/tasks/install.yml +++ b/roles/wordpress/tasks/install.yml @@ -90,8 +90,8 @@ dest: "/etc/{{ apache_config_dir }}/wordpress.conf" when: apache_enabled | bool -- name: "Add 'wordpress_installed: True' to {{ iiab_state_file }}" # /etc/iiab/iiab_state.yml +- name: "Add 'wordpress_installed: True' to {{ iiab_state_file }}" lineinfile: - dest: "{{ iiab_state_file }}" + dest: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml regexp: '^wordpress_installed' line: 'wordpress_installed: True' From ce2ea1990e445cdb00f32a5731ff8d6f7a75dc4e Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Jan 2020 21:39:37 -0500 Subject: [PATCH 18/19] moodle/tasks/enable.yml & WordPress tweaks --- roles/moodle/tasks/enable.yml | 46 ++++++++++++++++++++++---------- roles/wordpress/tasks/enable.yml | 8 +++--- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/roles/moodle/tasks/enable.yml b/roles/moodle/tasks/enable.yml index b625ecac6..755721436 100644 --- a/roles/moodle/tasks/enable.yml +++ b/roles/moodle/tasks/enable.yml @@ -1,21 +1,39 @@ -- name: Create symlink 022-moodle.conf from sites-enabled to sites-available, if moodle_enabled (debuntu) - file: - src: /etc/apache2/sites-available/022-moodle.conf - dest: /etc/apache2/sites-enabled/022-moodle.conf - state: link - when: moodle_enabled and is_debuntu +# Apache -- name: Remove symlink 022-moodle.conf, if not moodle_enabled (debuntu) - file: - path: /etc/apache2/sites-enabled/022-moodle.conf - state: absent - when: not moodle_enabled and is_debuntu +- name: Enable http://box/moodle via Apache + command: a2ensite 022-moodle.conf + when: apache_install and moodle_enabled -- name: Restart Apache service ({{ apache_service }}) +- name: Disable http://box/moodle via Apache + command: a2dissite 022-moodle.conf + when: apache_install and not moodle_enabled + +- name: Restart Apache systemd service ({{ apache_service }}) systemd: - name: "{{ apache_service }}" + name: "{{ apache_service }}" # apache2 or httpd, as set in /opt/iiab/iiab/vars/.yml state: restarted - daemon-reload: yes + when: apache_enabled | bool + +# NGINX + +- name: Enable http://box/moodle via NGINX, by installing {{ nginx_config_dir }}/moodle-nginx.conf from template + template: + src: moodle-nginx.conf.j2 + dest: "{{ nginx_config_dir }}/moodle-nginx.conf" + when: nginx_install and moodle_enabled + +- name: Disable http://box/moodle via NGINX, by removing {{ nginx_config_dir }}/moodle-nginx.conf + file: + path: "{{ nginx_config_dir }}/moodle-nginx.conf" + state: absent + when: nginx_install and not moodle_enabled + +- name: Restart 'nginx' systemd service + systemd: + name: nginx + state: restarted + when: nginx_enabled | bool + - name: Add 'moodle' variable values to {{ iiab_ini_file }} ini_file: diff --git a/roles/wordpress/tasks/enable.yml b/roles/wordpress/tasks/enable.yml index 397a48d61..b9b2cf0aa 100644 --- a/roles/wordpress/tasks/enable.yml +++ b/roles/wordpress/tasks/enable.yml @@ -1,10 +1,10 @@ # Apache -- name: "Enable http://box{{ wp_url }} via Apache" +- name: Enable http://box{{ wp_url }} via Apache command: a2ensite wordpress.conf when: apache_install and wordpress_enabled -- name: "Disable http://box{{ wp_url }} via Apache" +- name: Disable http://box{{ wp_url }} via Apache command: a2dissite wordpress.conf when: apache_install and not wordpress_enabled @@ -16,13 +16,13 @@ # NGINX -- name: "Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template" +- name: Enable http://box{{ wp_url }} via NGINX, by installing {{ nginx_config_dir }}/wordpress-nginx.conf from template template: src: wordpress-nginx.conf.j2 dest: "{{ nginx_config_dir }}/wordpress-nginx.conf" when: nginx_install and wordpress_enabled -- name: "Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf" +- name: Disable http://box{{ wp_url }} via NGINX, by removing {{ nginx_config_dir }}/wordpress-nginx.conf file: path: "{{ nginx_config_dir }}/wordpress-nginx.conf" state: absent From 68ce5721fcbbf2ca63901fffcef6b6f63500047a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 12 Jan 2020 22:15:59 -0500 Subject: [PATCH 19/19] KA Lite port correction in roles/nginx/README.md --- roles/nginx/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/nginx/README.md b/roles/nginx/README.md index ec457ba0a..42b1ec3c7 100644 --- a/roles/nginx/README.md +++ b/roles/nginx/README.md @@ -8,7 +8,7 @@ 1. Principal functions migrated to NGINX * Admin Console - * kalite -- goes directly to port 8009 + * kalite -- goes directly to ports 8006-8008 * mediawiki * osm-vector-maps * usb-lib