Backup/remove default.conf NGINX configuration file

Backup and then remove the default.conf configuration file created by NGINX upon initial installation
This commit is contained in:
Alessandro Fael Garcia 2018-04-06 16:05:23 -07:00
parent 8bf17d77c0
commit 681395baad
2 changed files with 36 additions and 0 deletions

View File

@ -1,4 +1,22 @@
---
- name: "(Setup: All NGINX) Check NGINX Default Configuration File Exists"
stat:
path: /etc/nginx/conf.d/default.conf
register: default_exists
- name: "(Setup: All NGINX) Backup NGINX Default Configuration File"
copy:
remote_src: yes
src: /etc/nginx/conf.d/default.conf
dest: /etc/nginx/conf.d/default.conf.bak
when: default_exists.stat.exists
- name: "(Setup: All NGINX) Delete NGINX Default Configuration File"
file:
path: /etc/nginx/conf.d/default.conf
state: absent
when: default_exists.stat.exists
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
copy:
src: "{{ main_upload_location }}"

View File

@ -1,4 +1,22 @@
---
- name: "(Setup: All NGINX) Check NGINX Default Configuration File Exists"
stat:
path: /etc/nginx/conf.d/default.conf
register: default_exists
- name: "(Setup: All NGINX) Backup NGINX Default Configuration File"
copy:
remote_src: yes
src: /etc/nginx/conf.d/default.conf
dest: /etc/nginx/conf.d/default.conf.bak
when: default_exists.stat.exists
- name: "(Setup: All NGINX) Delete NGINX Default Configuration File"
file:
path: /etc/nginx/conf.d/default.conf
state: absent
when: default_exists.stat.exists
- name: "(Setup: All NGINX) Dynamically Generate NGINX Main Configuration File"
template:
src: nginx.conf.j2