Deploying Wazuh with Ansible

Ansible gives teams a repeatable, reviewable way to install Wazuh and roll out agents across environments. This page explains how to design inventory, set role variables and keep the configuration in version control.

On this page

Why teams deploy Wazuh with Ansible

A platform or security team that has to rebuild Wazuh across several environments, and keep them consistent, has a different problem from a team installing one stack once. Ansible is one of the installation methods Wazuh documents, and it suits fleets and repeatable builds, where the same indexer, server, dashboard and agent configuration must appear in development, staging and production without someone retyping commands on each host. The Wazuh documentation lists Ansible alongside the all-in-one assistant, step-by-step installs, Docker, Kubernetes, Puppet and offline installation, so the choice is about how your environments need to be built and maintained, not about which method is supported.

The Wazuh Ansible roles automate the deployment of the four Wazuh components: the Wazuh indexer, which stores and searches alerts, the Wazuh server, which analyzes agent data with decoders and rules, the Wazuh dashboard, and the Wazuh agents installed on endpoints. Each component is handled by its own role and set of variables, so you can decide per environment how many nodes each component runs on, which hosts receive agents and how certificates and credentials are supplied. Confirm the exact role names, variable names and supported operating systems against the documentation for your release line before you write any playbook, since these details change between releases.

The all-in-one assistant is the faster choice for a single small environment that you will build once and rarely rebuild. It becomes the weaker choice when you need the same layout in several places, when you must review how each host was configured, or when you expect to reproduce a deployment after an outage. In those cases the playbooks become the record of the build, and the inventory, the variable files and the playbook history can be stored and reviewed in version control. Before you commit to this method, ask your team to confirm who will maintain the playbooks as Wazuh releases arrive, because the upgrade path is part of the same code.

Which Wazuh installation method fits which situation

This table compares the installation methods Wazuh documents against repeatability, team skills, change control and fit for multi-node layouts. Read each row against your own fleet size, team habits and change process, then use the Ansible column to judge whether codifying the deployment is worth the upfront effort. The main takeaway is that the Ansible path pays off when you expect to rebuild or extend the stack more than once.

MethodRepeatabilityTeam skills and change controlBest suited to
All-in-one assistantLow to moderate: rerunning on a new host means repeating the steps by hand unless you script themLow skill bar. Changes are usually made interactively, so tracking them in version control needs disciplineEvaluation or a single-host pilot where the layout is not expected to change
Step-by-step distributed installModerate: each node is installed separately, so drift between nodes is possibleRequires Linux administration and certificate handling for each node. Change control depends on your own recordsTeams that want full control of multi-node roles before automating
DockerModerate to high when the Compose files are kept in version controlNeeds container operations skills and kernel settings on the host. Image and file changes are easy to reviewTeams already running containers that want a contained, reproducible stack
Kubernetes and EKSHigh when manifests are managed through a GitOps or pipeline processNeeds cluster, storage and StatefulSet expertise. Suits teams that already operate KubernetesOrganizations that run Kubernetes and need persistent volumes and agent port exposure managed centrally
OVA virtual machineLow: a prebuilt image is a starting point, not a managed configurationLowest setup effort. Hard to bring under change control, so the vendor documentation points most production users to a planned installationEvaluation and training environments
Amazon Machine ImageLow to moderate: launches are repeatable, but instance configuration drifts unless managed by infrastructure codeNeeds AWS account, security group and storage skillsTeams on AWS that want a quick start before moving to a distributed layout
Ansible (Wazuh roles)High: inventory and role variables define each component, and reruns converge toward the declared stateRequires Ansible skills and a version-controlled repository. Changes pass through review and can be tested in stagingMulti-node or multi-site fleets, and teams that must show how production was built
PuppetHigh when the manifests are version-controlled and enforced on a scheduleRequires an existing Puppet practice and certificate management between Puppet nodesOrganizations that already standardize on Puppet across their estate
Offline installationDepends on the method used. Packages and vulnerability data must be staged and refreshed manuallyNeeds a connected staging host and a process to move packages across the air gapNetworks without internet access. Confirm which installation method your offline plan uses

Designing the inventory for indexer, server, dashboard and agents

The Ansible inventory is the map every role reads from, so its structure decides which variables apply, how certificates are issued and what order the rollout follows. Settle the grouping before the first run, because changing the layout later means reworking variables and certificates that were already generated.

Group hosts by component role

Create one inventory group for each Wazuh component: indexer, server and dashboard. Each host belongs to the group for the role it plays, and the roles apply their installation tasks by group membership. Keep hostnames stable and descriptive, because they become part of node names and certificate subject names. Ask whether a single host will carry more than one role, since a combined layout changes the variables and the rollout order.

Separate indexer, server and dashboard nodes

Treat each indexer, server and dashboard host as its own node with its own network address and identity. A distributed layout puts these components on separate hosts, which means the inventory must describe the network paths between them, such as the ports the server uses to reach the indexer. Confirm the layout against the vendor's distributed deployment guidance before writing the inventory, since a mismatch surfaces only during installation.

Wazuh deployment options

Plan cluster layouts before the first run

If the Wazuh server or indexer will run as a cluster, define the master and worker hosts and the indexer node count in the inventory from the start. Cluster membership affects certificate subject names, cluster configuration values and the order in which nodes start. Adding a node later can mean regenerating certificates and rerunning steps on existing hosts, so record the target topic layout in version control before the first deployment.

Drive certificates from inventory names

Certificate generation depends on the hostnames and addresses in the inventory. Each indexer, server and dashboard node needs a certificate that matches the name clients use to reach it. Decide whether certificates are generated once on a control host and distributed, or generated per node, and keep that decision consistent across playbook runs. Treat the certificate files as secrets and confirm where they are stored and who can read them.

Set the rollout order through groups

Ansible runs plays in the order you define them, so the inventory groups determine the rollout sequence. Indexers generally need to be available before the server connects to them, and the dashboard depends on both. Model that order as separate plays that target one group each, and test the order against a non-production inventory. Confirm the start order in the release documentation for the version you deploy.

Treat agent groups as a separate concern

Endpoints are not Wazuh infrastructure, so keep their inventory separate from the indexer, server and dashboard groups. Agent groups in Wazuh are a server-side concept used to push configuration to subsets of endpoints. Map each inventory group for agents to the Wazuh agent group that governs its configuration, and keep the mapping in version control so a host moving between teams or environments changes only one file.

Role variables for each component

The Wazuh indexer stores alerts and is the first component to configure, because the server and dashboard both depend on its node names, addresses and certificates. In the role variables, you set the indexer version, the cluster name and a node name for each host, plus the addresses other nodes use to reach it. Certificate inputs tell the role which node and admin certificates to generate or use, and the admin password is a credential the role needs at install time.

  • Version: pin the release line and patch version you have tested, and confirm the variable name in the role for that release line.
  • Node names and cluster name: each indexer host needs a unique node name that matches the certificate subject and the host list in the inventory.
  • Network addresses: set the bind and publish addresses so the server and other indexer nodes can reach the correct interface.
  • Certificate inputs: confirm which node certificate names and file paths the role expects, and keep them consistent with the inventory hostnames.
  • Admin credentials: supply the initial admin password through a vault variable, never a plain group variable file.

Before running the playbook, compare every variable name against the role documentation for your release, because names change between releases.

How to run the Wazuh Ansible roles step by step

This sequence takes a team from an empty control node to a Wazuh central deployment and an enrolled agent fleet, with a verification check at each stage so every change can be traced and repeated.

  1. Prepare the control node and repository

    The platform or automation engineer prepares a dedicated control node with Ansible installed, SSH access to the target hosts, and a private Git repository that holds the playbooks, inventory, variables and vault-encrypted secrets. Pin the Ansible and Wazuh role versions in the repository so every run uses known inputs. Confirm the work is done by running a connectivity check against a test host and verifying that the commit history records the pinned role versions.

  2. Design the inventory by component and group

    Define inventory groups that match Wazuh roles: indexer nodes, server nodes, dashboard hosts and agent groups by operating system and environment. Keep host variables for values that differ per machine, such as node names and IP addresses, and group variables for shared settings. Confirm the design by running the inventory listing command and checking that each host appears in exactly one component group and that the expected agent counts match your asset records.

  3. Set role variables for each component

    Set the variables that the Wazuh roles read for the indexer, server, dashboard and agents, including versions, listening addresses, cluster settings and the agent manager address. Store passwords and keys in an encrypted vault file rather than in plain text. Review the role documentation for the release you pinned, because variable names change between versions. Confirm the work by rendering the templates in check mode and reviewing the generated configuration files for correct addresses and no plain-text secrets.

  4. Generate or supply TLS certificates

    Decide whether certificates are generated by the playbook from a certificate definition file or supplied by your internal certificate authority. Each indexer, server and dashboard node needs a certificate that matches its name and address, and the agent enrollment path needs trusted certificates as well. Record the certificate authority, validity periods and renewal owner in the repository. Confirm the step by checking that each node's certificate chain verifies against the authority and that the subject names match the inventory.

  5. Run a dry run in check mode

    Run the playbooks with check mode and diff output against the staging inventory to see which tasks would change files, packages and services. Review the diffs for unexpected changes, such as overwritten certificates or altered cluster names, before any real run. Confirm the dry run is clean by reviewing that the only changes listed are the ones you expected for a first install or a planned upgrade.

  6. Deploy the central components

    Run the playbooks against the indexer, server and dashboard groups in that order, so storage is available before the server starts writing alerts and the dashboard connects to a working API. Fix any failed tasks in the repository and rerun, which is the idempotent behavior you want. Confirm the deployment by checking that the indexer cluster reports a healthy status, the server services are running, and the dashboard login page loads over HTTPS.

  7. Roll out and verify agents

    Run the agent playbook against one pilot group first, then expand to the remaining groups by operating system. Assign agents to groups in the configuration so policies apply on first contact. Confirm enrollment by checking that each pilot endpoint appears as active in the server agent list, that it reports inventory data to the dashboard, and that a rerun of the playbook makes no changes on those hosts.

How idempotent updates keep Wazuh changes predictable

Idempotence means that running the same playbook twice against an unchanged inventory should report no changes on the second run. For the Wazuh roles, that is the property that lets you treat the playbook as the description of your cluster rather than a one-off installer. The first run installs packages, writes ossec.conf, the indexer and dashboard settings and agent enrollment configuration. Later runs should only touch what differs from the variables in version control. If a run reports changes you did not intend, stop and find out why before the next run, because it usually means a variable changed, a host drifted, or a role task is not as idempotent as you assumed. Confirm which tasks in each role report changed on a no-op run by testing against a staging copy of your inventory first.

Make diff review a required step rather than a habit. Run the playbook in check mode with diff output, save the output with the change request, and have a second engineer read the changes to configuration files and service restarts. Pay particular attention to the variables for the indexer, server and dashboard, because a changed value there can restart components in an order that matters for your layout. Pin the Wazuh version explicitly in your variables so that a patch release is never applied by accident. The 4.14 line shipped patch releases on 17 March, 23 April, 1 July, 29 July, 23 September and 14 October 2026, roughly one every one to two months. That cadence means you will face a patch decision several times a year, so schedule an update window, test the new patch in staging, and move the version variable in a reviewed commit.

Separate what the roles change from what still needs a person. The roles can converge packages, configuration files and enrollment settings to the versions you declare, but operations such as upgrading a running cluster in the order the documentation requires, rotating certificates, taking indexer snapshots and verifying dashboard login after a change are steps you should plan and check yourself. Confirm in the Wazuh upgrade and certificate documentation which steps the roles automate for your target version and which must be run by hand, and record that list in your runbook. Also confirm whether a given role version supports the Wazuh release you pin, because a mismatch there is a more common source of surprise than a playbook bug.

How the Ansible control node reaches Wazuh components and agents

The run starts on the Ansible control node, which holds the inventory, role variables and playbooks kept in version control. Over the management network, it configures the indexer, server and dashboard hosts, then pushes the agent rollout to endpoints in a separate trust zone. Agents report back to the Wazuh server, so check that the control node, the server and the endpoints each have only the paths they need, and that the inventory matches the hosts you actually operate.

Control node paths into the Wazuh components, the management network and the endpoints.

Keeping Wazuh configuration in version control

Ansible only stays reproducible if the inventory, role variables, templates and secrets that produce a Wazuh environment live in a repository the team controls. The cards below cover how to lay that repository out, how to move changes between environments, and what must stay out of it.

Repository layout by component

Keep one playbook per concern (indexer, server, dashboard, agents) and separate inventory/production and inventory/staging directories with their own group_vars. Pin the Wazuh role version in a requirements file so a role update is a reviewed commit, not a side effect of running the playbook. Check that each host group maps to the component layout you chose, since a mismatch here is hard to spot in review.

Wazuh deployment options

Branching for environments

Use a short-lived branch per change and promote the same commit from staging to production rather than rebuilding it per environment. Only environment inventories and variable overrides should differ between branches. Ask your team to define who may merge to the production branch and whether a tagged commit is required before a production run.

Review of variable changes

Treat changes to agent group settings, manager ports, certificate paths and indexer memory as security-relevant changes, not routine edits. Require a second reviewer for any change that alters who can enroll agents or which ports are exposed. Run the playbook in check mode against staging and attach the diff output to the merge request so reviewers see the effect, not only the text.

Encrypted secrets with Ansible Vault

Store generated passwords, API credentials and private keys in files encrypted with Ansible Vault, and keep the vault password in your CI secret store or a password manager, never in the repository. Rotate vault passwords on a schedule your team sets and confirm that old encrypted files are re-keyed. Verify that no plaintext copy of the Wazuh admin or API credentials ends up in logs from failed runs.

What stays out of the repository

Keep generated certificates, private keys, agent registration secrets, indexer data, snapshots and host-specific runtime state out of version control, and add them to .gitignore. Store inventory facts that identify real hosts only where your access policy allows. Ask whether your organization needs the inventory itself treated as confidential, since it reveals your network layout.

Tagging configuration releases

Tag each production configuration release with the Wazuh version it deploys, such as the 4.14 line you targeted, and record the date and approver in the tag message. A tag lets you roll back to a known configuration and identify which change introduced a problem. Confirm with your team how tags map to the patch releases you schedule, since Wazuh ships patches roughly every one to two months.

Evidence for audits

Commit history, reviewed merge requests, tags and pipeline logs can show an assessor how configuration changed over time and who approved it. This is supporting evidence for your own controls, not an attestation. Ask your auditor which change records they accept and confirm that your pipeline retains logs long enough to cover the review period.

Questions teams ask before automating Wazuh with Ansible

What drives the cost and effort of automating a Wazuh deployment with Ansible?

The main drivers are the size of the inventory, the number of environments (for example, development, test and production), the cluster layout and the mix of agent platforms. A single-host lab with a few Linux agents is far less work than a multi-node indexer and server cluster with Windows, macOS and Linux endpoints, because each platform needs its own tested agent role variables and each component needs its own certificates and network paths. Costs are one-time for the role design, inventory model and first rollout, and recurring for role updates when Wazuh ships patch releases. Ask any provider for a written scope that lists the components, environments, operating systems and the number of hosts, and ask how changes and retests are priced.

Can our own team automate Wazuh with Ansible without a partner?

Yes, if your team already runs Linux configuration management, understands certificates and has someone who can read the Wazuh documentation closely. The work is not only writing playbooks. You need to design the inventory, decide how secrets are stored, test each role against representative hosts, and keep the variables in step with each Wazuh release. Teams often start in-house for a single environment and bring in outside help for the cluster layout, the first production rollout or a review of the finished automation. Make that decision by comparing your team's time and experience against the scope in the outline, not against the tool itself.

What does our organization need to provide for an Ansible-based Wazuh project?

Expect to provide a control node with Ansible installed and access to it, administrative access to the target hosts through an approved path, and a version-controlled repository where the inventory, variables and playbooks will live. You also need test hosts that match production operating systems, a place to store secrets such as generated passwords and certificates, and a change window for the first production run. Network paths between the indexer, server, dashboard and agents must be open or planned, and someone must own the approval for firewall changes. Confirm each item with your infrastructure and security teams before the work starts.

How does the timeline depend on the scope of the Wazuh automation?

The timeline depends on how many components and environments the playbooks must cover, how many agent platforms need tested roles, and how much review your change process requires. A plan that covers one environment and one agent platform takes less time than one that builds the same automation for production, staging and a disaster recovery site, with Linux and Windows endpoints. Approval cycles, access requests and the time needed to test in a non-production environment often take longer than the playbook writing itself. No duration is stated here because it varies with the environment, so ask for a timeline that lists these dependencies as separate milestones.

Which parts of the Ansible configuration should live in version control?

Keep the inventory, group and host variables, role variable overrides, playbooks, and the templates that produce configuration files in version control. Store secrets such as passwords, certificates and enrollment keys in an encrypted secrets mechanism, not in plain files. Pin the Wazuh role versions and the Wazuh release you deploy, so an update is a reviewed change rather than an accident. Idempotent runs help you confirm that a repeated playbook execution changes nothing unexpectedly. Ask the team that operates the deployment to review the layout before the first production run.

When is Wazuh Cloud or another installation method a better fit than Ansible?

Wazuh Cloud may fit better if you want the vendor to run the managed, cloud-delivered XDR and SIEM service and you do not need to host the components yourself. The self-hosted Wazuh software is open source with no license fee, but running it requires people, infrastructure and ongoing maintenance. Wazuh Cloud is offered with a 14-day free trial that needs no credit card, and its paid plans come in Small, Medium, Large and Custom tiers, with at least Standard support included. Other installation methods may fit better for a single small host (the all-in-one assistant or the prebuilt OVA for evaluation), for container-first platforms (Docker or Kubernetes), or for networks without internet access (the offline installation guide). Puppet is a documented alternative if your organization already standardizes on it. Choose the method that matches your existing configuration management and operating model.

What breaks most often in Ansible-driven Wazuh rollouts?

The most common failures come from inventory drift, where hosts exist in one environment but not in the variables that describe them, and from certificate or secret handling that differs between runs. Agent rollouts also fail when endpoints cannot reach the server on the required ports, when a platform role is tested on one operating system but applied to several, or when a Wazuh patch release changes variables that the playbooks still set the old way. Check each playbook run output, verify that agents appear as enrolled after the rollout, and confirm the dashboard and server status before you widen the rollout. Test every role change in a non-production environment before it reaches production.

How DeployOpen scopes and delivers Wazuh Ansible deployments

DeployOpen plans, implements, hardens, documents and supports self-hosted open-source platforms inside your own infrastructure, including Wazuh. For an Ansible-based Wazuh rollout, we agree the scope in writing first, build the playbooks and inventory in your version control, and hand over the code with the operating steps your team needs.

How we scope

  • We agree in writing which Wazuh components the playbooks will deploy, and which hosts and networks they will reach.
  • We confirm the inventory layout, agent counts and operating systems that the agent rollout must cover.
  • We record the decisions on certificates, credentials, vulnerability data source and offline or connected operation before build starts.

How we build

  • We write the Ansible roles and variables in your repository, with inventory separated by environment and component.
  • We test runs for idempotence, so repeated playbook runs make no unintended changes to a working deployment.
  • We configure agent enrollment and grouping through the playbooks and verify agents report to the server before handover.

How we hand over

  • You receive the playbooks, inventory, variable files and a runbook for installing and updating the stack.
  • We document how secrets are kept out of the repository and how your team rotates them.
  • We walk your engineers through running a dry run, a planned update and a rollback path against a test environment.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainer support can cover Wazuh release updates, which are shipped on a regular patch cadence that we review against your playbooks.
  • Ask us to confirm the support boundaries, response expectations and change process in the written scope before you sign.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.