From c30bfd3ee5b74c26f79071bb520b551e04e668fe Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 4 Oct 2024 08:35:07 +0200 Subject: [PATCH] refs #8025 README install improved, added local inventory --- .gitignore | 1 + README.md | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 242f284..86413b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vault.yml .passbolt.yml venv +inventories/local diff --git a/README.md b/README.md index 0731644..70d4e54 100644 --- a/README.md +++ b/README.md @@ -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 [-t tag1,tag2...] playbooks/ping.yml +ansible-playbook -i inventories/local -l [-t tag1,tag2...] playbooks/ping.yml ``` Run playbook on the fly on a host not declared in the inventory.