- Automation platform
- Use playbooks to automate tasks
- Multi-platform
- Open-source
- Complete tool and not just configuration management, including app deployment and other things
- Automation and orchestration are also possible using ansible
- Playbooks are written in YAML
- Playbooks execute modules that execute tasks, using servers and infos from inventory
- Modules are able to execute commands and scripts but is not limited to it
- The machine where ansible is installed is named as "control machine"
- Create a hosts file with some IP address from servers
- In the example course, a hosts file are used with some IPS from vagrant machines
- basic ad hoc command example
ansible all -i hosts -u vagrant -m setup
- command can scalate permission (
-b
andbecome
in playbooks) and also take arguments for the modules - The command module not necessarily use the shell from the machine
- playbooks could use variables and variables have precedence that should be analyzed
- playbooks are basically a list of tasks
- The tasks are executed in order from top to bottom
- playbooks can contain handlers tasks that are "played" when called in the end of another task in the task list using the argument
notify
- The playbook can contains one or more play
- Create groups to run tasks in specific machines
- galaxy.ansible.com for commom roles
ansible-galaxy init
creates the roles structure- A single playbook can be break into peaces and put in the roles structure
- This breaking needs to be done with attention to avoid confusing and to ensure the correct use of variables and configuration files (.j2)
- One playbook can include calls to many other plays in different roles that will be executed in any number of servers
- A complet UI to control all Ansible parametres
- Its possible to create a role based configuration and include permission to certain users
- The ansible tower already have a REST API