4. Ansible API Use Cases
• Server Provisioning Automation
• Wrapping Ansible calls in scripts
• Gaining deeper understanding of the
Ansible internals
5. Best Examples – Ansible Code Itself!
Ansible Ansible Playbook
6. Breaking it Down – Ansible API
3 module parameters
• Module Name
• Module Path
• Module Arguments
Several Authentication Options
• Remote user / pass
• User / pass / options for su(do)
• Vault password
• Private Key
7. Breaking it Down – Ansible API
• Inventory / Pattern / Subset
• Timeout
• Forks
• Callbacks
• Transport method
• Check / Diff options
8. Breaking it Down – Ansible-Playbook API
Shares many of the same arguments
Includes new arguments:
• Playbook (obviously!)
• Callbacks for runner and playbook
• Stats
• Extra variables
• Tag logic (skip, only)
• Force / flush handlers
CONNECTION TYPE
The connection type plugins allow you to add additional connection types. I’m not really sure what the use case would be unless you’re trying to support other operating systems.
LOOKUP TYPE
Lookup plugins allow access of data in Ansible from outside sources
VARS TYPE
Provide additional ways to get variables
FILTER TYPE
Provide additional filters on top of Jinja2
CALLBACKS TYPE
Calling back to report data
With callback plugins, you can have a little bit more power over your ansible runs and how your code tracks data. There are also some great examples online already. As silly as it may seem,