Update ansible code
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Adrien Reslinger 2022-08-16 17:09:58 +02:00
parent 156561e633
commit 18e86f8687
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
5 changed files with 120 additions and 118 deletions

View file

@ -1,17 +1,17 @@
---
- name: Check if agent is already registered
shell: cscli machines list -o raw | grep {{ inventory_hostname }} | grep true || echo "Not found"
ansible.builtin.shell: cscli machines list -o raw | grep {{ inventory_hostname }} | grep true || echo "Not found"
register: _csmachines
delegate_to: "{{ crowdsec_delegate_server_hostname }}"
changed_when: false
- block:
- name: Register agent to server
command: cscli lapi register -u {{ crowdsec_lapi_url }} --machine {{ inventory_hostname }}
ansible.builtin.command: cscli lapi register -u {{ crowdsec_lapi_url }} --machine {{ inventory_hostname }}
notify: restart crowdsec
- name: Validate agent on server
command: cscli machines validate {{ inventory_hostname }}
ansible.builtin.command: cscli machines validate {{ inventory_hostname }}
delegate_to: "{{ crowdsec_delegate_server_hostname }}"
when:
- _csmachines.rc == 0