1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

kolibri - softcode nginx_config_dir, add disable logic

This commit is contained in:
Jerry Vonau 2020-01-04 00:29:59 -06:00
parent 61b5800c19
commit b31c2035a6

View file

@ -3,11 +3,7 @@
name: kolibri name: kolibri
state: started state: started
enabled: yes enabled: yes
when: kolibri_enabled | bool when: 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 | bool and not nginx_enabled | bool
- name: Disable & Stop 'kolibri' systemd service if not kolibri_enabled - name: Disable & Stop 'kolibri' systemd service if not kolibri_enabled
systemd: systemd:
@ -16,11 +12,15 @@
state: stopped state: stopped
when: not kolibri_enabled 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 - name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled
command: a2dissite kolibri.conf 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: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: "{{ item.dest }}" dest: "{{ item.dest }}"
@ -28,24 +28,26 @@
owner: root owner: root
group: root group: root
with_items: with_items:
- { src: 'kolibri-nginx.conf.j2', dest: '/etc/nginx/conf.d/kolibri-nginx.conf', mode: '0644' } - { src: 'kolibri-nginx.conf.j2', dest: '{{ nginx_config_dir }}/kolibri-nginx.conf', mode: '0644' }
when: kolibri_enabled | bool and nginx_enabled | bool when: kolibri_enabled and nginx_enabled
- name: Disable http://box{{ kolibri_url }} with Apache (a2dissite) if not kolibri_enabled - name: Remove {{ nginx_config_dir }}/kolibri-nginx.conf when not nginx_enabled
command: a2dissite kolibri.conf file:
when: not kolibri_enabled or nginx_enabled | bool 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 - name: Restart Apache service ({{ apache_service }}) # e.g. apache2
systemd: systemd:
name: "{{ apache_service }}" name: "{{ apache_service }}"
state: restarted state: restarted
when: not nginx_enabled | bool when: not nginx_enabled
- name: Restart nginx service - name: Restart nginx service
systemd: systemd:
name: nginx name: nginx
state: restarted state: restarted
when: nginx_enabled | bool when: nginx_enabled
- name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini - name: Add 'kolibri' variable values to {{ iiab_ini_file }} # /etc/iiab/iiab.ini
ini_file: ini_file: