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: