# Ansible (master with worker)

#### Wazuh Manager server ec2

<pre class="language-bash"><code class="lang-bash"><strong>sudo apt update -y
</strong>sudo apt install software-properties-common -y
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
</code></pre>

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FhOAS0oKoQCWQTFH6UyWS%2Fimage.png?alt=media&#x26;token=efec96bd-b9dd-4e64-88e3-e1dcd003881f" alt=""><figcaption></figcaption></figure>

Create ssh-keygen with&#x20;

```bash
ssh-keygen -t rsa -b 2048
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FvN36w77HTeTGdOwaDKh5%2Fimage.png?alt=media&#x26;token=ce052c5e-a096-49d9-984b-d4805e0adbc6" alt=""><figcaption></figcaption></figure>

Copy this key and we'll add to agent server later.

```
cat ~/.ssh/id_rsa.pub
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2Ffq0I7JZYfMK63NW6U9bb%2Fimage.png?alt=media&#x26;token=a005fdef-0a16-4cbd-b255-4771810b1933" alt=""><figcaption></figcaption></figure>

Paste the given keys to authorized\_keys of wazuh agent server.

```
nano ~/.ssh/authorized_keys
```

<figure><img src="https://3155059101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ftpxp8dhlubc3j58Iygn5%2Fuploads%2FTY1OUixdYJ9AlcY3yzTj%2Fimage.png?alt=media&#x26;token=7abc49f7-81f2-4b0a-93d1-f4dd34b65665" alt=""><figcaption></figcaption></figure>

```
ansible all -i inventory/hosts -m ping

```
