From b31c2035a6719e21031f937a957ab1b7b9ce8f3d Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 4 Jan 2020 00:29:59 -0600 Subject: [PATCH] kolibri - softcode nginx_config_dir, add disable logic --- roles/kolibri/tasks/enable.yml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/roles/kolibri/tasks/enable.yml b/roles/kolibri/tasks/enable.yml index b2dca9682..484a9bdee 100644 --- a/roles/kolibri/tasks/enable.yml +++ b/roles/kolibri/tasks/enable.yml @@ -3,11 +3,7 @@ name: kolibri state: started enabled: yes - when: kolibri_enabled | bool - -- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri - command: a2ensite kolibri.conf - when: kolibri_enabled | bool and not nginx_enabled | bool + when: kolibri_enabled - name: Disable & Stop 'kolibri' systemd service if not kolibri_enabled systemd: @@ -16,11 +12,15 @@ state: stopped when: not kolibri_enabled +- name: Enable http://box{{ kolibri_url }} with Apache (a2ensite) if kolibri_enabled # i.e. http://box/kolibri + command: a2ensite kolibri.conf + when: kolibri_enabled and not nginx_enabled + - name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled command: a2dissite kolibri.conf - when: not kolibri_enabled or nginx_enabled | bool + when: not kolibri_enabled or nginx_enabled -- name: Supply /etc/nginx/conf.d/kolibri-nginx.conf when nginx_enabled +- name: Supply {{ nginx_config_dir }}/kolibri-nginx.conf when nginx_enabled template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -28,24 +28,26 @@ owner: root group: root with_items: - - { src: 'kolibri-nginx.conf.j2', dest: '/etc/nginx/conf.d/kolibri-nginx.conf', mode: '0644' } - when: kolibri_enabled | bool and nginx_enabled | bool + - { src: 'kolibri-nginx.conf.j2', dest: '{{ nginx_config_dir }}/kolibri-nginx.conf', mode: '0644' } + when: kolibri_enabled and nginx_enabled -- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled - command: a2dissite kolibri.conf - when: not kolibri_enabled or nginx_enabled | bool +- name: Remove {{ nginx_config_dir }}/kolibri-nginx.conf when not nginx_enabled + file: + path: "{{ nginx_config_dir }}/kolibri-nginx.conf" + state: absent + when: not kolibri_enabled and nginx_enabled - name: Restart Apache service ({{ apache_service }}) # e.g. apache2 systemd: name: "{{ apache_service }}" state: restarted - when: not nginx_enabled | bool + when: not nginx_enabled - name: Restart nginx service systemd: name: nginx state: restarted - when: nginx_enabled | bool + when: nginx_enabled - name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini ini_file: