mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +00:00
70 lines
2.1 KiB
YAML
70 lines
2.1 KiB
YAML
- name: Put the config file in place
|
|
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: "/etc/nginx/conf.d/iiab.conf" }
|
|
when: nginx_enabled
|
|
|
|
- name: Clean stale config files
|
|
file:
|
|
state: absent
|
|
path: '{{ item.path }}'
|
|
with_items:
|
|
- { path: "/etc/nginx/conf.d/usb-lib.conf" }
|
|
- { path: "/etc/nginx/conf.d/modules.conf" }
|
|
|
|
- name: Insure that apache2 is not running -- we may need port swap
|
|
systemd:
|
|
name: apache2
|
|
state: stopped
|
|
|
|
# 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
|
|
|
|
# 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/<rolename>/template/
|
|
|
|
- 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:
|
|
name: nginx
|
|
state: stopped
|
|
enabled: false
|
|
when: not nginx_enabled
|
|
|
|
- name: Disable Apache port {{ apache_port }} localhost only
|
|
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
|
|
include_tasks: disable.yml
|
|
when: not nginx_enabled
|
|
|
|
- name: Since we stopped apache2, start it again
|
|
systemd:
|
|
name: apache2
|
|
state: restarted
|
|
enabled: true
|
|
daemon_reload: yes
|
|
when: apache_enabled
|
|
|
|
- name: Restart nginx to pick up the config files installed
|
|
systemd:
|
|
name: nginx
|
|
state: restarted
|
|
enabled: true
|
|
when: nginx_enabled
|