Modify the conditional on the "agent registration via api" block

This commit is contained in:
Angelo Lisco 2018-03-30 14:15:01 +02:00
parent 4a4504f3a6
commit d0dbd3f5af
2 changed files with 22 additions and 14 deletions

View File

@ -25,19 +25,23 @@ Playbook example
The following is an example how this role can be used: The following is an example how this role can be used:
- hosts: all:!wazuh-manager - hosts: all:!wazuh-manager
roles: roles:
- ansible-wazuh-agent - ansible-wazuh-agent
vars: vars:
wazuh_managers: wazuh_managers:
- address: 127.0.0.1 - address: 127.0.0.1
port: 1514 port: 1514
protocol: udp protocol: udp
wazuh_agent_authd: api_port: 55000
enable: true api_proto: 'http'
port: 1515 api_user: 'ansible'
ssl_agent_ca: null wazuh_agent_authd:
ssl_auto_negotiate: 'no' enable: true
port: 1515
ssl_agent_ca: null
ssl_auto_negotiate: 'no'
License and copyright License and copyright
--------------------- ---------------------

View File

@ -97,6 +97,8 @@
when: when:
- check_keys.stat.size == 0 - check_keys.stat.size == 0
- wazuh_managers.0.address is not none - wazuh_managers.0.address is not none
- wazuh_managers.0.api_user is not none
- api_pass is not none
delegate_to: localhost delegate_to: localhost
become: no become: no
tags: tags:
@ -114,6 +116,8 @@
when: when:
- check_keys.stat.size == 0 - check_keys.stat.size == 0
- wazuh_managers.0.address is not none - wazuh_managers.0.address is not none
- wazuh_managers.0.api_user is not none
- api_pass is not none
- newagent_api.json.error == 0 - newagent_api.json.error == 0
register: newagentkey_api register: newagentkey_api
delegate_to: localhost delegate_to: localhost
@ -141,7 +145,7 @@
- api - api
notify: restart wazuh-agent notify: restart wazuh-agent
when: wazuh_agent_authd.enable == false and ( wazuh_managers.0.api_user is defined and api_pass is defined ) when: wazuh_agent_authd.enable == false
- name: Linux | Vuls integration deploy (runs in background, can take a while) - name: Linux | Vuls integration deploy (runs in background, can take a while)
command: /var/ossec/wodles/vuls/deploy_vuls.sh {{ ansible_distribution|lower }} {{ ansible_distribution_major_version|int }} command: /var/ossec/wodles/vuls/deploy_vuls.sh {{ ansible_distribution|lower }} {{ ansible_distribution_major_version|int }}