Ansible API

Post on 08-May-2015

417 views 3 download

description

A short and sweet presentation going over the API within Ansible that was provided at the Austin Ansible Meet Up on June 25th.

Transcript of Ansible API

Leveraging the Ansible APITyler Turk – DevOps Engineer at WP Engine

Who am I?

DevOps Engineer at WP Engine

Enjoys Operations, Development, and long walks on the beach

Ansible API

Ansible API Use Cases

• Server Provisioning Automation

• Wrapping Ansible calls in scripts

• Gaining deeper understanding of

the Ansible internals

Best Examples – Ansible Code Itself!

Ansible Ansible Playbook

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

Breaking it Down – Ansible API• Inventory / Pattern / Subset

• Timeout

• Forks

• Callbacks

• Transport method

• Check / Diff options

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

Inventory Management

• Need to define inventory

• Can define subset

• Easy to instantiate

Ansible Plugins

Types of plugins:

• Connection Type

• Lookup

• Vars

• Filter

• Callbacks

Callback Plugins – Ooo, interesting…

• Customize actions

• Aggregate/manipulate results

• Create historic logs and

dashboards

Examples!

Questions? There are some “less good” ones…