main #31

Merged
juan merged 154 commits from main into lab 2024-10-16 15:22:43 +00:00
2 changed files with 17 additions and 9 deletions
Showing only changes of commit c30bfd3ee5 - Show all commits

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
.vault.yml
.passbolt.yml
venv
inventories/local

View File

@ -4,12 +4,16 @@ Collection of Ansible playbooks used in the Verdnatura server farm.
## Setup Ansible
Install Ansible on Debian.
### Debian
Install Ansible package.
```
apt install ansible
```
Create Python virtual environment.
### Python
Create a Python virtual environment.
```
python3 -m venv venv
source venv/bin/activate
@ -17,11 +21,6 @@ pip install --upgrade pip ansible==10.1.0 ansible-builder==3.1.0
pip install -r requirements.txt
```
Install dependencies.
```
ansible-galaxy collection install -r collections/requirements.yml
```
Before running any Ansible command, activate the Python virtual environment.
```
source venv/bin/activate
@ -32,14 +31,22 @@ Once you're done, deactivate the virtual environment.
deactivate
```
### All platforms
Install dependencies.
```
ansible-galaxy collection install -r collections/requirements.yml
```
## Run playbook
Before merging changes into protected branches, playbooks should be tested
locally to ensure they work properly.
locally to ensure they work properly. The *local* inventory can also be used,
wich is not uploaded to the repository.
Run playbook on inventory host.
```
ansible-playbook -i inventories/lab -l <host> [-t tag1,tag2...] playbooks/ping.yml
ansible-playbook -i inventories/local -l <host> [-t tag1,tag2...] playbooks/ping.yml
```
Run playbook on the fly on a host not declared in the inventory.