Core components Flashcards
Inventories
how Ansible can locate and run against multiple systems. Inventories are list of hosts Can be formatted in ini or yaml 1. ini mail.example.com [webservers] rale.example.com dale.example.com [dbservers] db[1:4].example.com
- ## yamlall:
hosts:
mail.example.com:
children:
webservers:
hosts:
rail.example.com:
dale.example.com:
dbservers:
hosts:
db[1:4].example.com:
…
Modules
Tools for particular tasks
Modules take parameters and return json response
Variables
Should contain letters, numbers and underscores
Should start with letter
Can be scoped by a group, host, playbook
Facts
Provide certain info about a given target host
Facts are discovered by Ansible aoutomatically when it reaches out to a host
Facts gathering can be disabled
ansible -i ansible/inventory.yaml host6.example.com -m setup
=> output will be collection of facts represented
Plays
To map a group of hosts to some well-defined roles
A play may use one or more modules to achieve a desired state on a group of hosts
Playbooks
Series of plays
Config files
Locations in order processing:
- ANSIBLE_CONFIG (an env var)
- ansible.cfg (in the current dir)
- .ansible.cfg (in home dir hidden file)
- /etc/ansible/ansible.cfg (master config)
Some commonly used settings:
ansible_managed
forks
inventory