Skip to content

Commit 25d216c

Browse files
committed
Move agent tasks to correct playbook
1 parent 766ca30 commit 25d216c

File tree

2 files changed

+32
-46
lines changed

2 files changed

+32
-46
lines changed

etc/kayobe/ansible/wazuh-agent.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,35 @@
55
tasks:
66
- import_role:
77
name: "wazuh-ansible/wazuh-ansible/roles/wazuh/ansible-wazuh-agent"
8+
post_tasks:
9+
- name: Check if custom SCA policies directory exists
10+
stat:
11+
path: "{{ local_custom_sca_policies_path }}"
12+
register: custom_sca_policies_folder
13+
delegate_to: localhost
14+
15+
- name: Gather list of custom SCA policies
16+
find:
17+
paths: "{{ local_custom_sca_policies_path }}"
18+
patterns: '*.yml'
19+
delegate_to: localhost
20+
register: custom_sca_policies
21+
when: custom_sca_policies_folder.stat.exists
22+
23+
- name: Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
24+
become: yes
25+
blockinfile:
26+
path: "/var/ossec/etc/local_internal_options.conf"
27+
state: present
28+
owner: wazuh
29+
group: wazuh
30+
block: sca.remote_commands=1
31+
when: custom_sca_policies.files | length > 0
32+
notify:
33+
- Restart wazuh-agent
34+
35+
handlers:
36+
- name: Restart wazuh-agent
37+
service:
38+
name: wazuh-agent
39+
state: restarted

etc/kayobe/ansible/wazuh-manager.yml

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -105,49 +105,3 @@
105105
command: filebeat test output
106106
changed_when: false
107107
retries: 2
108-
109-
handlers:
110-
- name: Restart wazuh
111-
service:
112-
name: wazuh-manager
113-
state: restarted
114-
115-
- name: Restart wazuh-dashboard
116-
service:
117-
name: wazuh-dashboard
118-
state: restarted
119-
120-
- hosts: wazuh-agent
121-
become_user: root
122-
tasks:
123-
- name: Check if custom SCA policies directory exists
124-
stat:
125-
path: "{{ local_custom_sca_policies_path }}"
126-
register: custom_sca_policies_folder
127-
delegate_to: localhost
128-
129-
- name: Gather list of custom SCA policies
130-
find:
131-
paths: "{{ local_custom_sca_policies_path }}"
132-
patterns: '*.yml'
133-
delegate_to: localhost
134-
register: custom_sca_policies
135-
when: custom_sca_policies_folder.stat.exists
136-
137-
- name: Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
138-
become: yes
139-
blockinfile:
140-
path: "/var/ossec/etc/local_internal_options.conf"
141-
state: present
142-
owner: wazuh
143-
group: wazuh
144-
block: sca.remote_commands=1
145-
when: custom_sca_policies.files | length > 0
146-
notify:
147-
- Restart wazuh-agent
148-
149-
handlers:
150-
- name: Restart wazuh-agent
151-
service:
152-
name: wazuh-agent
153-
state: restarted

0 commit comments

Comments
 (0)