Collection of Ansible playbooks used in the Verdnatura server farm
Go to file
Juan Ferrer 1adc5db4df Merge branch 'main' of https://gitea.verdnatura.es/verdnatura/vn-ansible 2024-10-01 14:14:58 +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 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
inventories refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
playbooks refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
roles Merge branch 'main' of https://gitea.verdnatura.es/verdnatura/vn-ansible 2024-10-01 14:14:58 +02:00
.gitignore refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
README.md refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +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 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
requirements.txt refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
vault-playbook.sh refs #8025 #7892 roles debian-once & debian-host, sysctl, README, environment 2024-10-01 14:14:51 +02:00
vault.yml refs #8025 Vault added, core hosts splitted, tasks parametized, auth enabled 2024-09-27 13:26:47 +02:00

README.md

Verdnatura Ansible playbooks

Collection of Ansible playbooks used in the Verdnatura server farm.

Install Ansible

Instal Ansible on Debian.

apt install ansible

Install dependencies.

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

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

Run playbook

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

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

ansible-playbook -i <ip_or_hostname>, [-t tag1,tag2] playbooks/test.yml

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

Manage vault

To manage Ansible vault place the password into .vaultpass file.

View or edit the vault file.

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

When running playbooks that use the vault the vault-playbook.sh script can be used, it is ovelay over the original ansible-playbook command.

Create execution environment

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

ansible-builder build --tag ansible-runner: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