Ansible: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 11: Line 11:
     ├─ staging/
     ├─ staging/
     │  └─ academia/
     │  └─ academia/
     │    ├─ group_vars/
     │    ├─ inventory.yml
     │    │  ├─ all.yaml
     │    └─ group_vars/
     │     │  └─ academia_group.yaml
     │       ├─ academia_group.yaml
     │     └─ inventory.yml
     │       └─ all.yaml
     └─ test/
     └─ test/
       └─ academia/
       └─ academia/
           ├─ group_vars/
           ├─ inventory.yml
          │  ├─ all.yaml
          └─ group_vars/
          │  └─ academia_group.yaml
              ├─ academia_group.yaml
          └─ inventory.yml
              └─ all.yaml


<source lang="bash">
<source lang="bash">

Revision as of 02:17, 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
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

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