File tree Expand file tree Collapse file tree 3 files changed +40
-13
lines changed
Expand file tree Collapse file tree 3 files changed +40
-13
lines changed Original file line number Diff line number Diff line change 3333 register : custom_sca_policies
3434 when : custom_sca_policies_folder.stat.exists
3535
36- - name : Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
37- blockinfile :
38- path : " /var/ossec/etc/local_internal_options.conf"
39- state : present
40- owner : wazuh
41- group : wazuh
42- block : |
43- sca.remote_commands=1
44- when : custom_sca_policies.files | length > 0
45-
4636 - name : Copy custom SCA policy files to Wazuh manager
4737 copy :
4838 # Note the trailing slash to copy directory contents
125115 service :
126116 name : wazuh-dashboard
127117 state : restarted
118+
119+ - hosts : wazuh-agent
120+ become : yes
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+ become : no
129+
130+ - name : Gather list of custom SCA policies
131+ find :
132+ paths : " {{ local_custom_sca_policies_path }}"
133+ patterns : ' *.yml'
134+ delegate_to : localhost
135+ register : custom_sca_policies
136+ when : custom_sca_policies_folder.stat.exists
137+
138+ - name : Allow Wazuh agents to execute commands in SCA policies sent from the Wazuh manager
139+ blockinfile :
140+ path : " /var/ossec/etc/local_internal_options.conf"
141+ state : present
142+ owner : wazuh
143+ group : wazuh
144+ block : |
145+ sca.remote_commands=1
146+ when : custom_sca_policies.files | length > 0
147+ notify :
148+ - Restart wazuh-agent
149+
150+ handlers :
151+ - name : Restart wazuh-agent
152+ service :
153+ name : wazuh-agent
154+ state : restarted
Original file line number Diff line number Diff line change 1+ ---
2+ # Ansible custom SCA policies directory
3+ local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
Original file line number Diff line number Diff line change @@ -24,9 +24,6 @@ local_certs_path: "{{ playbook_dir }}/wazuh/certificates"
2424# Ansible control host custom certificates directory
2525local_custom_certs_path: "{{ playbook_dir }}/wazuh/custom_certificates"
2626
27- # Ansible custom SCA policies directory
28- local_custom_sca_policies_path: "{{ kayobe_env_config_path }}/wazuh/custom_sca_policies"
29-
3027# Indexer variables
3128indexer_node_name: "{{ inventory_hostname }}"
3229
You can’t perform that action at this time.
0 commit comments