- pre_tasks
- hadlers of pre_task
- roles
- tasks
- handlers of roles and tasks
- post_tasks
- handlers of post_tasks
- ansible_all_ipv4_addresses
- name: Reboot a slow machine that might have lots of updates to apply
reboot:
reboot_timeout: 3600
- name: Force all notified handlers to run at this point, not waiting for normal sync points
meta: flush_handlers
- hosts: all
tasks
- name: Create a group of all hosts by operating system
group_by: key={{ansible_distribution}}
- hosts: Ubuntu
tasks
- debug: msg=foo
# show docs for a module
ansible-doc $module_name
# list callbacks
ansible-doc -t callback -l
There are some things you can do to increase performance.
Mitogen updates Ansible’s slow and wasteful shell-centric implementation with pure-Python equivalents...
- Download mitogen
- Change the configuration
[defaults]
strategy_plugins = /path/to/mitogen-0.2.9/ansible_mitogen/plugins/strategy
strategy = mitogen_linear
- hosts: all
gather_facts: false
Avoid the usage of loop
if you can
Modules like yum
can install packages in parallel (with a single command).
Use these options to profile your roles
[defaults]
callback_whitelist=timer, profile_tasks, cgroup_perf_recap
Turn on control master and pipelining
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s
pipelining = true