Ansible: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 264: Line 264:
* [https://molecule.readthedocs.io/en/latest/ci.html Ansible » Test » Molecule » CI/CD]
* [https://molecule.readthedocs.io/en/latest/ci.html Ansible » Test » Molecule » CI/CD]
* [https://www.cherryservers.com/blog/how-to-set-up-ansible-inventory-file Ansible » Set Up Inventory File]
* [https://www.cherryservers.com/blog/how-to-set-up-ansible-inventory-file Ansible » Set Up Inventory File]
* [https://marketplace.visualstudio.com/items?itemName=redhat.ansible Ansible » VS Code Extension]
* [https://www.digitalocean.com/community/tutorials/how-to-set-up-ansible-inventories Ansible » Set Up Inventories]
* [https://www.digitalocean.com/community/tutorials/how-to-set-up-ansible-inventories Ansible » Set Up Inventories]
* [https://spacelift.io/blog/ansible-variables Ansible » Types of Variables]
* [https://spacelift.io/blog/ansible-variables Ansible » Types of Variables]
Line 286: Line 287:


| valign="top" |
| valign="top" |
* [https://marketplace.visualstudio.com/items?itemName=redhat.ansible Ansible » VS Code Extension]


| valign="top" |
| valign="top" |


|}
|}

Revision as of 06:29, 27 November 2022

sudo apt update  && sudo apt list  --upgradeable
sudo apt upgrade && sudo apt install ansible
ansible --version

Playbook

chorke-academia-project
├─ main_playbook.yml
└─ inventories/
   ├─ staging/
   │  └─ academia/
   │     ├─ inventory.yml
   │     └─ group_vars/
   │        ├─ academia_group.yaml
   │        └─ all.yaml
   └─ test/
      └─ academia/
         ├─ inventory.yml
         └─ group_vars/
             ├─ academia_group.yaml
             └─ all.yaml
mkdir -p chorke-academia-project/inventories/{staging,test}/academia/{group_vars,host_vars,user_vars}
touch    chorke-academia-project/inventories/{staging,test}/academia/group_vars/{all,academia_group}.yaml
touch    chorke-academia-project/inventories/{staging,test}/academia/inventory.yml
touch    chorke-academia-project/main_playbook.yml

cd chorke-academia-project
ansible-playbook  -i inventories/staging main_playbook.yml
ansible-inventory -i inventories/staging --list

Modules





Namespaces


Knowledge

python3 -m venv .venv --prompt="academia"
# source .venv/bin/activate
# (academia) $
python3 -m venv .venv --prompt="molecule"
# source .venv/bin/activate
# (molecule) $
python -m venv .venv --prompt="molecule"
# .venv\Scripts\activate
# (molecule) PS>

pip install -r requirements.txt
pip freeze   > requirements.txt

ansible-inventory -i inventory --list
ansible all -i inventory -m ping
ansible-playbook -i inventory playbook.yml

References