- block:
  - name: base | software | install wazuh agent
    apt:
      deb: https://packages.wazuh.com/4.x/apt/pool/main/w/wazuh-agent/wazuh-agent_4.8.0-1_amd64.deb
    environment:
      WAZUH_MANAGER: "{{ wazuh_manager }}"
      PATH: "/usr/sbin:{{ lookup('env', 'PATH') }}"

  - name: systemctl daemon-reload
    systemd:
      daemon-reload: yes

  - name: Start Wazuh agent
    systemd:
      name: "wazuh-agent"
      state: started
      enabled: yes
  become: yes