ansible-role-nginx/tasks/conf/push-config.yml
Alessandro Fael Garcia c545949653 Fix stat path
Use the path for nginx.conf instead of default.conf
2018-04-17 15:21:07 -07:00

57 lines
1.6 KiB
YAML

---
- name: "(Setup: All NGINX) Check NGINX Default Configuration File Exists"
stat:
path: /etc/nginx/nginx.conf
when: main_push_enable
register: main_exists
- name: "(Setup: All NGINX) Backup NGINX Default Configuration File"
copy:
remote_src: yes
src: /etc/nginx/nginx.conf
dest: /etc/nginx/nginx.conf.bak
when: main_exists.stat.exists and main_exists.stat.isreg and main_push_enable
- name: "(Setup: All NGINX) Delete NGINX Default Configuration File"
file:
path: /etc/nginx/nginx.conf
state: absent
when: main_exists.stat.exists is defined and main_exists.stat.isreg and main_push_enable
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
copy:
src: "{{ main_push_location }}"
dest: /etc/nginx/nginx.conf
notify: "(Handler: All OSs) Reload NGINX"
when: main_push_enable
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
file:
path: /etc/nginx/conf.d/http
state: directory
when: http_push_enable
- name: "(Setup: All NGINX) Upload NGINX HTTP Configuration Files"
copy:
src: "{{ item }}"
dest: /etc/nginx/conf.d/http
with_fileglob:
- "{{ http_push_location }}"
notify: "(Handler: All OSs) Reload NGINX"
when: http_push_enable
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
file:
path: /etc/nginx/conf.d/stream
state: directory
when: stream_push_enable
- name: "(Setup: All NGINX) Upload NGINX Stream Configuration Files"
copy:
src: "{{ item }}"
dest: /etc/nginx/conf.d/stream
with_fileglob:
- "{{ stream_push_location }}"
notify: "(Handler: All OSs) Reload NGINX"
when: stream_push_enable