Install wazuh agent deb file for linux target hosts

any one help me to write playbook for wazuh agent(.deb file) installation in linux target hosts.

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html#playbook-syntax
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_module.html

I have not tested it, check it yourself. Ali

correction
---- name: Install Wazuh agent
hosts:
become: yes

tasks:

  • name: Add Wazuh repository key
    apt_key:
    url: https://packages.wazuh.com/key/GPG-KEY-WAZUH
    state: present

  • name: Add Wazuh repository
    apt_repository:
    repo: “deb https://packages.wazuh.com/4.x/apt/ stable main”
    state: present

  • name: Update apt cache
    apt:
    update_cache: yes

  • name: Install Wazuh agent
    apt:
    name: wazuh-agent
    state: present

  • name: Configure Wazuh agent
    copy:
    src: /path/to/wazuh-agent.conf
    dest: /var/ossec/etc/shared/wazuh-agent.conf
    owner: root
    group: ossec
    mode: ‘0640’
    notify:

  • restart wazuh-agent

handlers:

  • name: restart wazuh-agent
    service:
    name: wazuh-agent
    state: restarted