Skip to content

Commit 681395b

Browse files
committed
Backup/remove default.conf NGINX configuration file
Backup and then remove the default.conf configuration file created by NGINX upon initial installation
1 parent 8bf17d7 commit 681395b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tasks/conf/push-config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
---
2+
- name: "(Setup: All NGINX) Check NGINX Default Configuration File Exists"
3+
stat:
4+
path: /etc/nginx/conf.d/default.conf
5+
register: default_exists
6+
7+
- name: "(Setup: All NGINX) Backup NGINX Default Configuration File"
8+
copy:
9+
remote_src: yes
10+
src: /etc/nginx/conf.d/default.conf
11+
dest: /etc/nginx/conf.d/default.conf.bak
12+
when: default_exists.stat.exists
13+
14+
- name: "(Setup: All NGINX) Delete NGINX Default Configuration File"
15+
file:
16+
path: /etc/nginx/conf.d/default.conf
17+
state: absent
18+
when: default_exists.stat.exists
19+
220
- name: "(Setup: All NGINX) Upload NGINX Main Configuration File"
321
copy:
422
src: "{{ main_upload_location }}"

tasks/conf/template-config.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
11
---
2+
- name: "(Setup: All NGINX) Check NGINX Default Configuration File Exists"
3+
stat:
4+
path: /etc/nginx/conf.d/default.conf
5+
register: default_exists
6+
7+
- name: "(Setup: All NGINX) Backup NGINX Default Configuration File"
8+
copy:
9+
remote_src: yes
10+
src: /etc/nginx/conf.d/default.conf
11+
dest: /etc/nginx/conf.d/default.conf.bak
12+
when: default_exists.stat.exists
13+
14+
- name: "(Setup: All NGINX) Delete NGINX Default Configuration File"
15+
file:
16+
path: /etc/nginx/conf.d/default.conf
17+
state: absent
18+
when: default_exists.stat.exists
19+
220
- name: "(Setup: All NGINX) Dynamically Generate NGINX Main Configuration File"
321
template:
422
src: nginx.conf.j2

0 commit comments

Comments
 (0)