Skip to content

Architecture

Push model - Ruby based - demon less * Procedural * it creates top to bottom

Inventory

  • U can use pass the arguments direcly to the ivnentory
[test_server]
control_test type: client
node_test type: server
  • The beterr approach is to use the ansible_hostname ( since it first performs uname -n)

  • If u want to execute one host at a time use the serial varaible

  • To use the host group for the playbook use inventory_hostname

  hosts: home_machines
  vars:
    user_home: "/home/{{ inventory_hostname }}"

Diffrences

Docs

Ansiable hosname vs
inventory_hostname

Example:

# to show use ansible-invetory --graph or --list in json output 
[webserver]
servera
servec
[dbservers]
servdb
##Nested groups 
[Nested:children]
webserver
dbservers

Dynamic inventories

Remember to define dynamic groups as empty in the static inventory file elswere the ansible will error

Ansible MAIN


Ansible.cfg


Ansible vault


Ansible playbook


Refrences

ansible-navigator

Ansible commands

teraform

Puppet