Automation

    Wazuh Agent Mass Deployment with Ansible

    Roll out the Wazuh agent across hundreds of hosts using the official Wazuh Ansible playbooks. Inventory setup, role install, manager enrollment and verification.

    WazuGuardix Team June 16, 2026 8 min read

    For fleets of more than a handful of endpoints, install the Wazuh agent with Ansible. The official `wazuh-ansible` roles deploy the agent, manage the configuration template and enroll the host against the manager.

    1. Prerequisites

    • Ansible 2.10 or newer on the control node
    • SSH access from the control node to every target
    • Privilege escalation (become) configured

    2. Install the Wazuh Ansible roles

    git clone https://github.com/wazuh/wazuh-ansible.git
    cd wazuh-ansible

    3. Define your inventory

    # inventory.ini
    [wazuh_agents]
    web-01 ansible_host=10.0.1.10
    web-02 ansible_host=10.0.1.11
    db-01  ansible_host=10.0.1.20
    
    [wazuh_agents:vars]
    ansible_user=ubuntu
    ansible_become=true

    4. Write the playbook

    # deploy-wazuh-agent.yml
    - hosts: wazuh_agents
      roles:
        - role: ansible-wazuh-agent
          vars:
            wazuh_managers:
              - address: 10.0.0.5
                port: 1514
                protocol: tcp
                api_port: 55000
                api_proto: https

    5. Run the playbook

    ansible-playbook -i inventory.ini deploy-wazuh-agent.yml

    6. Verify on the manager

    /var/ossec/bin/agent_control -l | head

    All inventory hosts should appear as Active. Re-running the playbook is idempotent, safe to schedule via CI for drift correction.

    Official reference

    Commands and configuration in this guide are based on the official Wazuh documentation. For the canonical source, see:

    WazuhAnsibleMass DeploymentAutomation

    Need help running Wazuh in production?

    Our team designs, deploys and operates Wazuh end to end, from indexer sizing to custom rules and 24/7 SOC monitoring.