Skip to content

Commit 616b7d3

Browse files
committed
style(roles): add backup: true to all template tasks
1 parent a5891d7 commit 616b7d3

124 files changed

Lines changed: 275 additions & 22 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5454

5555
### Changed
5656

57+
* **roles**: Add `backup: true` to all `ansible.builtin.template` tasks to ensure config file backups before overwriting
5758
* **role:nextcloud**: Refactor `nextcloud-update.j2`
5859
* **role:keycloak**: Rework `keycloak.conf` template to match Keycloak's default config structure
5960
* **role:apache_httpd**: bump Core Rule Set to 4.24.1

roles/acme_sh/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
- name: 'Deploy /etc/systemd/system/acme-sh.service'
3131
ansible.builtin.template:
32+
backup: true
3233
src: 'etc/systemd/system/acme-sh.service.j2'
3334
dest: '/etc/systemd/system/acme-sh.service'
3435
owner: 'root'
@@ -37,6 +38,7 @@
3738

3839
- name: 'Deploy /etc/systemd/system/acme-sh.timer'
3940
ansible.builtin.template:
41+
backup: true
4042
src: 'etc/systemd/system/acme-sh.timer.j2'
4143
dest: '/etc/systemd/system/acme-sh.timer'
4244
owner: 'root'

roles/apache_httpd/tasks/confs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
- name: 'Create conf-available configs'
2727
ansible.builtin.template:
28+
backup: true
2829
src: 'etc/httpd/conf-available/{{ item["template"]}}.conf.j2'
2930
dest: '{{ apache_httpd__config_path }}/{{ apache_httpd__config_prefix }}conf-available/{{ item["filename"] }}.conf'
3031
owner: 'root'

roles/apache_httpd/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
- name: 'Create or update global Apache configuration {{ apache_httpd__config_file }}'
8484
ansible.builtin.template:
85+
backup: true
8586
src: 'etc/httpd/conf/httpd.conf.j2'
8687
dest: '{{ apache_httpd__config_file }}'
8788
owner: 'root'

roles/apache_httpd/tasks/matomo.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- name: 'Deploy Matomo Log Analytics Python Script to /usr/local/sbin/import_logs.py'
22
ansible.builtin.template:
3+
backup: true
34
src: 'usr/local/sbin/import_logs.py.j2'
45
dest: '/usr/local/sbin/import_logs.py'
56
owner: '{{ apache_httpd__user }}'

roles/apache_httpd/tasks/mods.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
- name: 'Create mods-available configs'
2727
ansible.builtin.template:
28+
backup: true
2829
src: 'etc/httpd/mods-available/{{ item["template"] | d(item["filename"]) }}.conf.j2'
2930
dest: '{{ apache_httpd__config_path }}/{{ apache_httpd__config_prefix }}mods-available/{{ item["filename"] }}.conf'
3031
owner: 'root'

roles/apache_httpd/tasks/vhosts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
- name: 'Create sites-available vHosts'
4949
ansible.builtin.template:
50+
backup: true
5051
src: 'etc/httpd/sites-available/{{ item["template"] }}.conf.j2'
5152
dest: '{{ apache_httpd__config_path }}/{{ apache_httpd__config_prefix }}sites-available/{{ item["filename"] | d(item["conf_server_name"] ~ "." ~ (item["virtualhost_port"] | d(443))) }}.conf'
5253
owner: 'root'

roles/apache_solr/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,14 @@
7777

7878
- name: 'Deploy {{ apache_solr__install_dir }}/solr/bin/solr.in.sh'
7979
ansible.builtin.template:
80+
backup: true
8081
src: 'opt/solr/bin/solr.in.sh.j2'
8182
dest: '{{ apache_solr__install_dir }}/solr/bin/solr.in.sh'
8283
notify: 'apache_solr: restart solr.service'
8384

8485
- name: 'Deploy {{ apache_solr__log4j_props }}'
8586
ansible.builtin.template:
87+
backup: true
8688
src: 'var/solr/log4j.xml.j2'
8789
dest: '{{ apache_solr__log4j_props }}'
8890
notify: 'apache_solr: restart solr.service'
@@ -138,6 +140,7 @@
138140

139141
- name: 'Deploy /etc/systemd/system/solr.service'
140142
ansible.builtin.template:
143+
backup: true
141144
src: 'etc/systemd/system/solr.service.j2'
142145
dest: '/etc/systemd/system/solr.service'
143146
owner: 'root'
@@ -185,6 +188,7 @@
185188

186189
- name: 'Deploy {{ apache_solr__var_dir }}/security.json'
187190
ansible.builtin.template:
191+
backup: true
188192
src: 'var/solr/security.json.j2'
189193
dest: '{{ apache_solr__var_dir }}/security.json'
190194
notify: 'apache_solr: restart solr.service'

roles/apache_tomcat/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
- name: 'Deploy /etc/tomcat/server.xml'
5454
ansible.builtin.template:
55+
backup: true
5556
src: 'etc/tomcat/{{ tomcat__installed_version }}-server.xml.j2'
5657
dest: '/etc/tomcat/server.xml'
5758
owner: 'root'
@@ -61,6 +62,7 @@
6162

6263
- name: 'Copy tomcat config /etc/sysconfig'
6364
ansible.builtin.template:
65+
backup: true
6466
src: 'etc/sysconfig/{{ tomcat__installed_version }}-tomcat.j2'
6567
dest: '/etc/sysconfig/tomcat'
6668
owner: 'root'
@@ -69,6 +71,7 @@
6971

7072
- name: 'Deploy /etc/tomcat/context.xml'
7173
ansible.builtin.template:
74+
backup: true
7275
src: 'etc/tomcat/{{ tomcat__installed_version }}-context.xml.j2'
7376
dest: '/etc/tomcat/context.xml'
7477
owner: 'root'
@@ -78,6 +81,7 @@
7881

7982
- name: 'Deploy /etc/tomcat/logging.properties'
8083
ansible.builtin.template:
84+
backup: true
8185
src: 'etc/tomcat/{{ tomcat__installed_version }}-logging.properties.j2'
8286
dest: '/etc/tomcat/logging.properties'
8387
owner: 'root'
@@ -87,6 +91,7 @@
8791

8892
- name: 'Copy tomcat logrotate template to /etc/logrotate.d'
8993
ansible.builtin.template:
94+
backup: true
9095
src: 'etc/logrotate.d/tomcat.j2'
9196
dest: '/etc/logrotate.d/tomcat'
9297
owner: 'root'
@@ -104,6 +109,7 @@
104109

105110
- name: 'Deploy /var/lib/tomcat/webapps/docs/META-INF/context.xml'
106111
ansible.builtin.template:
112+
backup: true
107113
src: 'var/lib/tomcat/webapps/docs/META-INF/context.xml.j2'
108114
dest: '/var/lib/tomcat/webapps/docs/META-INF/context.xml'
109115
owner: 'root'
@@ -115,6 +121,7 @@
115121

116122
- name: 'Deploy /var/lib/tomcat/webapps/host-manager/META-INF/context.xml'
117123
ansible.builtin.template:
124+
backup: true
118125
src: 'var/lib/tomcat/webapps/host-manager/META-INF/context.xml.j2'
119126
dest: '/var/lib/tomcat/webapps/host-manager/META-INF/context.xml'
120127
owner: 'root'
@@ -126,6 +133,7 @@
126133

127134
- name: 'Deploy /var/lib/tomcat/webapps/manager/META-INF/context.xml'
128135
ansible.builtin.template:
136+
backup: true
129137
src: 'var/lib/tomcat/webapps/manager/META-INF/context.xml.j2'
130138
dest: '/var/lib/tomcat/webapps/manager/META-INF/context.xml'
131139
owner: 'root'
@@ -137,6 +145,7 @@
137145

138146
- name: 'Deploy /var/lib/tomcat/webapps/manager/WEB-INF/web.xml'
139147
ansible.builtin.template:
148+
backup: true
140149
src: 'var/lib/tomcat/webapps/manager/WEB-INF/web.xml.j2'
141150
dest: '/var/lib/tomcat/webapps/manager/WEB-INF/web.xml'
142151
owner: 'root'
@@ -159,6 +168,7 @@
159168

160169
- name: 'Deploy /etc/tomcat/tomcat-users.xml'
161170
ansible.builtin.template:
171+
backup: true
162172
src: 'etc/tomcat/{{ tomcat__installed_version }}-tomcat-users.xml.j2'
163173
dest: '/etc/tomcat/tomcat-users.xml'
164174
owner: 'root'

roles/audit/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
- name: 'Deploy /etc/audit/auditd.conf'
1111
ansible.builtin.template:
12+
backup: true
1213
src: 'etc/audit/auditd.conf.j2'
1314
dest: '/etc/audit/auditd.conf'
1415
owner: 'root'

0 commit comments

Comments
 (0)