Collection of Ansible playbooks used in the Verdnatura server farm
Go to file
Xavi Lleó 9464d6d8a3 Refs #8025 Crazy git 2024-10-03 10:45:21 +02:00
collections refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
context refs #8025 Passbolt integration, README improved, ansible vault deleted, EE fixes 2024-10-02 13:20:37 +02:00
inventories refs #8025 Fix: Get NSLCD password from Passbolt 2024-10-02 13:34:54 +02:00
playbooks Refs #8025 Debian.yml - Forward Fast Juan 2024-10-02 14:02:22 +02:00
roles refs #8025 Fix: Get NSLCD password from Passbolt 2024-10-02 13:34:54 +02:00
.gitignore refs #8025 Passbolt integration, README improved, ansible vault deleted, EE fixes 2024-10-02 13:20:37 +02:00
README.md refs #8025 Passbolt integration, README improved, ansible vault deleted, EE fixes 2024-10-02 13:20:37 +02:00
ansible.cfg refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
execution-environment.yml refs #8025 Passbolt integration, README improved, ansible vault deleted, EE fixes 2024-10-02 13:20:37 +02:00
requirements.txt refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
run-playbook.sh refs #8025 Passbolt integration, README improved, ansible vault deleted, EE fixes 2024-10-02 13:20:37 +02:00

README.md

Verdnatura Ansible playbooks

Collection of Ansible playbooks used in the Verdnatura server farm.

Setup Ansible

Install Ansible on Debian.

apt install ansible

Create Python virtual environment.

python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip ansible==10.1.0 ansible-builder==3.1.0
pip install -r requirements.txt
deactivate

Install dependencies.

ansible-galaxy collection install -r collections/requirements.yml

Before running any Ansible command, activate the Python virtual environment.

source venv/bin/activate

Run playbook

Before merging changes into protected branches, playbooks should be tested locally to ensure they work properly.

Run playbook on inventory host.

ansible-playbook -i inventories/lab -l <host> [-t tag1,tag2...] playbooks/ping.yml

Run playbook on the fly on a host not declared in the inventory.

ansible-playbook -i <ip_or_hostname>, playbooks/ping.yml

Note the comma at the end of the hostname or IP.

Manage secrets

Secrets can be managed by using Ansible vault or an external keystore, Passbolt is used in this case. It is recommended to use an external keystore to avoid publicly exposing the secrets, even if they are encrypted.

When running playbooks that use any of the keystores mentioned above, the run-playbook.sh script can be used, it is an ovelay over the original ansible-playbook command which injects the necessary parameters.

Ansible vault

To manage Ansible vault place the encryption password into .vault-pass file.

Manage the vault.

ansible-vault {view,edit,create} --vault-pass-file .vault-pass .vault.yml

[!CAUTION] The files used for the vault must only be used locally and under no circumstances can they be uploaded to the repository.

Passbolt

Add the necessary environment variables to the .passbolt.yml file:

Build execution environment for AWX

Create an image with ansible-builder and upload it to registry.

ansible-builder build --tag awx-ee:vn1

Common playbooks

  • facts.yml: Collect and display facts from a host
  • ping.yml: Check that a host is alive and reachable
  • awx.yml: Create and configure AWX user
  • debian.yml: Setup base Debian server

Documentation