Skip to content

Commit 694db44

Browse files
committed
Allow to override any template or file
1 parent b80c1c1 commit 694db44

File tree

14 files changed

+51
-27
lines changed

14 files changed

+51
-27
lines changed

roles/wazuh/ansible-filebeat-oss/defaults/main.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ filebeatrepo:
2626
apt: "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/5.x/apt/ stable main"
2727
yum: 'https://packages.wazuh.com/5.x/yum/'
2828
gpg: 'https://packages.wazuh.com/key/GPG-KEY-WAZUH'
29-
path: '/tmp/WAZUH-GPG-KEY'
29+
path: '/tmp/WAZUH-GPG-KEY'
30+
31+
filebeat_config_template: 'filebeat.yml.j2'

roles/wazuh/ansible-filebeat-oss/tasks/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- block:
33
- name: Copy Filebeat configuration.
44
template:
5-
src: filebeat.yml.j2
5+
src: "{{ filebeat_config_template }}"
66
dest: "/etc/filebeat/filebeat.yml"
77
owner: root
88
group: root

roles/wazuh/ansible-wazuh-agent/defaults/main.yml

+4
Original file line numberDiff line numberDiff line change
@@ -374,3 +374,7 @@ wazuh_agent_config_defaults:
374374

375375
labels: '{{ wazuh_agent_labels }}'
376376
enrollment: '{{ wazuh_agent_enrollment }}'
377+
378+
wazuh_agent_ossec_configuration_template: 'var-ossec-etc-ossec-agent.conf.j2'
379+
wazuh_agent_ossec_local_internal_options_template: 'var-ossec-etc-local-internal-options.conf.j2'
380+
wazuh_agent_ossec_authdpass_template: 'authd_pass.j2'

roles/wazuh/ansible-wazuh-agent/tasks/Linux.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@
219219

220220
- name: Linux | Installing agent configuration (ossec.conf)
221221
template:
222-
src: var-ossec-etc-ossec-agent.conf.j2
222+
src: "{{ wazuh_agent_ossec_configuration_template }}"
223223
dest: "{{ wazuh_dir }}/etc/ossec.conf"
224224
owner: root
225225
group: wazuh
@@ -231,7 +231,7 @@
231231

232232
- name: Linux | Installing local_internal_options.conf
233233
template:
234-
src: var-ossec-etc-local-internal-options.conf.j2
234+
src: "{{ wazuh_agent_ossec_local_internal_options_template }}"
235235
dest: "{{ wazuh_dir }}/etc/local_internal_options.conf"
236236
owner: root
237237
group: wazuh
@@ -243,7 +243,7 @@
243243

244244
- name: Create auto-enrollment password file
245245
template:
246-
src: authd_pass.j2
246+
src: "{{ wazuh_agent_ossec_authdpass_template }}"
247247
dest: "{{ wazuh_dir }}/etc/authd.pass"
248248
owner: wazuh
249249
group: wazuh

roles/wazuh/ansible-wazuh-agent/tasks/Windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@
8989

9090
- name: Windows | Installing agent configuration (ossec.conf)
9191
template: # noqa 208
92-
src: var-ossec-etc-ossec-agent.conf.j2
92+
src: "{{ wazuh_agent_ossec_configuration_template }}"
9393
dest: "{{ wazuh_agent_win_path }}ossec.conf"
9494
notify: Windows | Restart Wazuh Agent
9595
tags:
9696
- config
9797

9898
- name: Windows | Installing local_internal_options.conf
9999
template:
100-
src: var-ossec-etc-local-internal-options.conf.j2
100+
src: "{{ wazuh_agent_ossec_local_internal_options_template }}"
101101
dest: "{{ wazuh_agent_win_path }}local_internal_options.conf"
102102
notify: Windows | Restart Wazuh Agent
103103
tags:

roles/wazuh/ansible-wazuh-agent/tasks/macOS.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189

190190
- name: macOS | Installing agent configuration (ossec.conf)
191191
template:
192-
src: var-ossec-etc-ossec-agent.conf.j2
192+
src: "{{ wazuh_agent_ossec_configuration_template }}"
193193
dest: "{{ wazuh_macos_config.install_dir }}/etc/ossec.conf"
194194
owner: root
195195
group: wazuh
@@ -201,7 +201,7 @@
201201

202202
- name: macOS | Installing local_internal_options.conf
203203
template:
204-
src: var-ossec-etc-local-internal-options.conf.j2
204+
src: "{{ wazuh_agent_ossec_local_internal_options_template }}"
205205
dest: "{{ wazuh_macos_config.install_dir }}/etc/local_internal_options.conf"
206206
owner: root
207207
group: wazuh
@@ -213,7 +213,7 @@
213213

214214
- name: Create auto-enrollment password file
215215
template:
216-
src: authd_pass.j2
216+
src: "{{ wazuh_agent_ossec_authdpass_template }}"
217217
dest: "{{ wazuh_macos_config.install_dir }}/etc/authd.pass"
218218
owner: wazuh
219219
group: wazuh
@@ -228,4 +228,4 @@
228228
- name: macOS | Delete downloaded Wazuh agent installer file
229229
file:
230230
path: "{{ wazuh_macos_config.download_dir }}{{ wazuh_macos_package_name }}"
231-
state: absent
231+
state: absent

roles/wazuh/ansible-wazuh-manager/defaults/main.yml

+10
Original file line numberDiff line numberDiff line change
@@ -464,3 +464,13 @@ wazuh_manager_config_defaults:
464464
# format: 'eventchannel'
465465
# - location: 'System'
466466
# format: 'eventlog'
467+
468+
wazuh_manager_ossec_local_rules_template: 'var-ossec-rules-local_rules.xml.j2'
469+
wazuh_manager_ossec_local_decoder_template: 'var-ossec-rules-local_decoder.xml.j2'
470+
wazuh_manager_ossec_shared_agent_template: 'var-ossec-etc-shared-agent.conf.j2'
471+
wazuh_manager_ossec_local_internal_options_template: 'var-ossec-etc-local-internal-options.conf.j2'
472+
wazuh_manager_ossec_server_template: 'var-ossec-etc-ossec-server.conf.j2'
473+
wazuh_manager_ossec_authdpass_template: 'authd_pass.j2'
474+
wazuh_manager_adminjson_template: 'admin.json.j2'
475+
wazuh_manager_agentless_template: 'agentless.j2'
476+
wazuh_manager_create_user_script_file: 'create_user.py'

roles/wazuh/ansible-wazuh-manager/tasks/main.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
- config
134134

135135
- name: Installing the local_rules.xml (default local_rules.xml)
136-
template: src=var-ossec-rules-local_rules.xml.j2
136+
template: src="{{ wazuh_manager_ossec_local_rules_template }}"
137137
dest="{{ wazuh_dir }}/etc/rules/local_rules.xml"
138138
owner=wazuh
139139
group=wazuh
@@ -157,7 +157,7 @@
157157
- rules
158158

159159
- name: Installing the local_decoder.xml
160-
template: src=var-ossec-rules-local_decoder.xml.j2
160+
template: src="{{ wazuh_manager_ossec_local_decoder_template }}"
161161
dest="{{ wazuh_dir }}/etc/decoders/local_decoder.xml"
162162
owner=wazuh
163163
group=wazuh
@@ -182,7 +182,7 @@
182182

183183
- name: Configure the shared-agent.conf
184184
template:
185-
src: var-ossec-etc-shared-agent.conf.j2
185+
src: "{{ wazuh_manager_ossec_shared_agent_template }}"
186186
dest: "{{ wazuh_dir }}/etc/shared/default/agent.conf"
187187
owner: wazuh
188188
group: wazuh
@@ -196,7 +196,7 @@
196196
- shared_agent_config is defined
197197

198198
- name: Installing the local_internal_options.conf
199-
template: src=var-ossec-etc-local-internal-options.conf.j2
199+
template: src="{{ wazuh_manager_ossec_local_internal_options_template }}"
200200
dest="{{ wazuh_dir }}/etc/local_internal_options.conf"
201201
owner=root
202202
group=wazuh
@@ -279,7 +279,7 @@
279279

280280
- name: Configure ossec.conf
281281
template:
282-
src: var-ossec-etc-ossec-server.conf.j2
282+
src: "{{ wazuh_manager_ossec_server_template }}"
283283
dest: "{{ wazuh_dir }}/etc/ossec.conf"
284284
owner: root
285285
group: wazuh
@@ -291,7 +291,7 @@
291291

292292
- name: Ossec-authd password
293293
template:
294-
src: authd_pass.j2
294+
src: "{{ wazuh_manager_ossec_authdpass_template }}"
295295
dest: "{{ wazuh_dir }}/etc/authd.pass"
296296
owner: wazuh
297297
group: wazuh
@@ -308,15 +308,15 @@
308308
block:
309309
- name: Copy create_user script
310310
copy:
311-
src: create_user.py
311+
src: "{{ wazuh_manager_create_user_script_file }}"
312312
dest: "{{ wazuh_dir }}/framework/scripts/create_user.py"
313313
owner: root
314314
group: wazuh
315315
mode: 0644
316316

317317
- name: Create admin.json
318318
template:
319-
src: templates/admin.json.j2
319+
src: "{{ wazuh_manager_adminjson_template }}"
320320
dest: "{{ wazuh_dir }}/api/configuration/admin.json"
321321
owner: wazuh
322322
group: wazuh
@@ -344,7 +344,7 @@
344344

345345
- name: Agentless Hosts & Passwd
346346
template:
347-
src: agentless.j2
347+
src: "{{ wazuh_manager_agentless_template }}"
348348
dest: "{{ wazuh_dir }}/agentless/.passlist_tmp"
349349
owner: root
350350
group: root

roles/wazuh/wazuh-dashboard/defaults/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ indexer_admin_password: changeme
2929
dashboard_user: kibanaserver
3030
dashboard_password: changeme
3131
local_certs_path: "{{ playbook_dir }}/indexer/certificates"
32+
33+
wazuh_dashboard_configuration_template: 'opensearch_dashboards.yml.j2'
34+
wazuh_dashboard_wazuh_plugin_template: 'wazuh.yml.j2'

roles/wazuh/wazuh-dashboard/tasks/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
- name: Copy Configuration File
2929
template:
30-
src: "templates/opensearch_dashboards.yml.j2"
30+
src: "{{ wazuh_dashboard_configuration_template }}"
3131
dest: "{{ dashboard_conf_path }}/opensearch_dashboards.yml"
3232
group: wazuh-dashboard
3333
owner: wazuh-dashboard
@@ -75,7 +75,7 @@
7575

7676
- name: Configure Wazuh Dashboard Plugin
7777
template:
78-
src: wazuh.yml.j2
78+
src: "{{ wazuh_dashboard_wazuh_plugin_template }}"
7979
dest: /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml
8080
owner: wazuh-dashboard
8181
group: wazuh-dashboard

roles/wazuh/wazuh-indexer/defaults/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,8 @@ indexer_nolog_sensible: true
5151

5252
# Docker image for certificates generation on macOS
5353
wazuh_certs_tool_docker: "wazuh/wazuh-cert-tool:{{ indexer_version }}"
54+
55+
wazuh_indexer_internal_users_template: 'internal_users.yml.j2'
56+
wazuh_indexer_jvm_options_template: 'jvm.options.j2'
57+
wazuh_indexer_opensearch_config_template: 'opensearch.yml.j2'
58+
wazuh_indexer_certificates_generation_template: 'config.yml.j2'

roles/wazuh/wazuh-indexer/tasks/local_actions.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
- name: Local action | Prepare the certificates generation template file
3232
template:
33-
src: "templates/config.yml.j2"
33+
src: "{{ wazuh_indexer_certificates_generation_template }}"
3434
dest: "{{ local_certs_path }}/config.yml"
3535
mode: 0644
3636
register: tlsconfig_template

roles/wazuh/wazuh-indexer/tasks/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
- name: Copy Opensearch Configuration File
4343
template:
44-
src: "templates/opensearch.yml.j2"
44+
src: "{{ wazuh_indexer_opensearch_config_template }}"
4545
dest: "{{ indexer_conf_path }}/opensearch.yml"
4646
owner: root
4747
group: wazuh-indexer
@@ -54,9 +54,9 @@
5454
- security
5555

5656

57-
- name: Configure Wazuh indexer JVM memmory.
57+
- name: Configure Wazuh indexer JVM memory.
5858
template:
59-
src: "templates/jvm.options.j2"
59+
src: "{{ wazuh_indexer_jvm_options_template }}"
6060
dest: "{{ indexer_conf_path }}/jvm.options"
6161
owner: root
6262
group: wazuh-indexer

roles/wazuh/wazuh-indexer/tasks/security_actions.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
- name: Copy the Opensearch security internal users template
4242
template:
43-
src: "templates/internal_users.yml.j2"
43+
src: "{{ wazuh_indexer_internal_users_template }}"
4444
dest: "{{ indexer_sec_plugin_conf_path }}/internal_users.yml"
4545
mode: 0644
4646
run_once: true

0 commit comments

Comments
 (0)