refs #8025 README install improved, added local inventory
This commit is contained in:
parent
6d68f76434
commit
c30bfd3ee5
|
@ -3,3 +3,4 @@
|
|||
.vault.yml
|
||||
.passbolt.yml
|
||||
venv
|
||||
inventories/local
|
||||
|
|
25
README.md
25
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 <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.
|
||||
|
|
Loading…
Reference in New Issue