1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +00:00

Update nginx/tasks/main.yml

This commit is contained in:
A Holt 2020-01-11 15:11:38 -05:00 committed by GitHub
parent d8e4a9f05e
commit 0b11126ee0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,32 +1,32 @@
- name: Put the config file in place - name: "Install from template: /etc/nginx/server.conf, /etc/nginx/nginx.conf, /etc/{{ apache_service }}/ports.conf, {{ nginx_config_dir }}/iiab.conf"
template: template:
src: '{{ item.src}}' src: "{{ item.src}}"
dest: '{{ item.dest }}' dest: "{{ item.dest }}"
with_items: with_items:
- { src: "server.conf",dest: "/etc/nginx/" } - { src: "server.conf", dest: "/etc/nginx/" }
- { src: "nginx.conf",dest: "/etc/nginx/" } - { src: "nginx.conf", dest: "/etc/nginx/" }
- { src: "ports.conf" , dest: "/etc/{{ apache_service }}/" } - { src: "ports.conf", dest: "/etc/{{ apache_service }}/" }
- { src: "iiab.conf.j2",dest: "{{ nginx_config_dir }}/iiab.conf" } - { src: "iiab.conf.j2", dest: "{{ nginx_config_dir }}/iiab.conf" }
when: nginx_enabled when: nginx_enabled | bool
- name: Clean stale config files - name: Remove stale files (usb-lib.conf, modules.conf) from {{ nginx_config_dir }}
file: file:
state: absent state: absent
path: '{{ item.path }}' path: "{{ item.path }}"
with_items: with_items:
- { path: "{{ nginx_config_dir }}/usb-lib.conf" } - { path: "{{ nginx_config_dir }}/usb-lib.conf" }
- { path: "{{ nginx_config_dir }}/modules.conf" } - { path: "{{ nginx_config_dir }}/modules.conf" }
- name: Insure that apache2 is not running -- we may need port swap - name: Ensure that Apache (({{ apache_service }})) is not running -- we may need port swap
systemd: systemd:
name: apache2 name: "{{ apache_service }}"
state: stopped state: stopped
# the below slides in nginx's proxypass config files for apache on localhost # the below slides in nginx's proxypass config files for apache on localhost
# via the ports.conf file installed above # 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 include_tasks: uses_apache.yml
when: nginx_enabled when: nginx_enabled | bool
# the below task contains the same logic contained in the playbooks to enable # 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 # 'runrole nginx' to do the right thing but with the 'src' path set to role's
@ -34,9 +34,9 @@
- name: Install proxpass to other services 'dual mode' roles - name: Install proxpass to other services 'dual mode' roles
include_tasks: only_nginx.yml 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: systemd:
name: nginx name: nginx
state: stopped state: stopped
@ -50,21 +50,21 @@
when: not nginx_enabled when: not nginx_enabled
# should have the logic to handle both modes in the playbook # 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 include_tasks: disable.yml
when: not nginx_enabled when: not nginx_enabled
- name: Since we stopped apache2, start it again - name: Enable & Restart Apache, since we stopped it ({{ apache_service }})
systemd: systemd:
name: apache2 name: "{{ apache_service }}"
daemon_reload: yes
state: restarted state: restarted
enabled: true enabled: true
daemon_reload: yes when: apache_enabled | bool
when: apache_enabled
- name: Restart nginx to pick up the config files installed - name: Enable & Restart NGINX, to pick up the config files installed
systemd: systemd:
name: nginx name: nginx
state: restarted state: restarted
enabled: true enabled: true
when: nginx_enabled when: nginx_enabled | bool