Office of Technology
Zuul
Ansible
Technical Committee
Developer Infrastructure Core Team
Former Foundation Board of Directors
PTL of shade project
Ansible is a radically simple IT automation engine that automates cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.
simple.yaml
- hosts: all
tasks:
- name: Print hostname of server
command: hostname
A playbook containing a play that will run against all hosts in the inventory. It has one task that uses the command module to run the "hostname" command.
longer.yaml
- hosts: git
roles:
- create-mirror-locations
- hosts: code-review.example.com
roles:
- create-repositories
A playboook containing two plays. The first runs a role called "create-mirror-locations" against a group of hosts from the inventory called "git". Then it runs a role called "create-repositories" against a host from the inventory called "code-review.example.com".
Don't let the existence of Rackspace modules confuse you. The OpenStack modules work just great on Rackspace
A provider decided to redefine the OpenStack Availability Zone concept complete with incompatible API changes. That is unsupportable.
PS. Don't do that
OpenStack in Ansible and Multi-cloud Operations are easy...
but you need to know a few things.
os_
New inventory plugin coming in Ansible 2.4
USER_CONFIG_DIR is different on Linux, OSX and Windows.
SITE_CONFIG_DIR is different on Linux, OSX and Windows.
For multi-cloud, think of two types:
Simple example of a clouds.yaml
clouds:
my-citycloud:
profile: citycloud
auth:
username: mordred
project_id: 65222a4d09ea4c68934fa1028c77f394
user_domain_id: d0919bd5e8d74e49adf0e145807ffc38
project_domain_id: d0919bd5e8d74e49adf0e145807ffc38
Where's the password?
clouds:
my-citycloud:
auth:
password: XXXXXXXX
More information can be provided.
my-vexxhost:
identity_api_version: 3
image_endpoint_override: https://image-ca-ymq-1.vexxhost.net/v2
profile: vexxhost
auth:
user_domain_id: default
project_domain_id: default
project_name: d8af8a8f-a573-48e6-898a-af333b970a2d
username: 0b8c435b-cc4d-4e05-8a47-a2ada0539af1
my-internap:
auth:
auth_url: https://identity.api.cloud.iweb.com
username: api-55f9a00fb2619
project_name: inap-17037
identity_api_version: 3
floating_ip_source: None
regions:
- name: ams01
values:
networks:
- name: inap-17037-WAN1654
routes_externally: true
default_interface: true
- name: inap-17037-LAN3631
routes_externally: false
ansible:
use_hostnames: False
expand_hostvars: True
fail_on_errors: True
---
- hosts: localhost
tasks:
- os_auth:
cloud: "{{ item.cloud }}"
region_name: "{{ item.region }}"
with_items:
- cloud: my-vexxhost
region: ca-ymq-1
- cloud: my-citycloud
region: Buf1
- cloud: my-internap
region: ams01
- hosts: localhost
tasks:
- os_server:
name: "my-server"
cloud: "{{ item.cloud }}"
region_name: "{{ item.region }}"
image: "{{ item.image }}"
flavor: "{{ item.flavor }}"
auto_ip: true
with_items:
- cloud: my-vexxhost
region: ca-ymq-1
image: Ubuntu 16.04.1 LTS [2017-03-03]
flavor: v1-standard-4
- cloud: my-citycloud
region: Buf1
image: Ubuntu 16.04 Xenial Xerus
flavor: 4C-4GB-100GB
- cloud: my-internap
region: ams01
image: Ubuntu 16.04 LTS (Xenial Xerus)
flavor: A1.4
python ~/src/github.com/ansible/ansible/contrib/inventory/openstack.py --list
- hosts: localhost
tasks:
- os_server:
cloud: "{{ item.cloud }}"
region_name: "{{ item.region }}"
name: my-server
state: absent
with_items:
- cloud: my-vexxhost
region: ca-ymq-1
- cloud: my-citycloud
region: Buf1
- cloud: my-internap
region: ams01
https://git.openstack.org/cgit/openstack/ansible-role-cloud-launcher
http://linch-pin.readthedocs.io/en/develop/
Linch-pin provides a collection of Ansible playbooks for provisioning, decommissioning, and managing resources across multiple infrastructures. The main goal of linch-pin is to facilitate provisioning and orchestration of resources in a multi-cloud environment through a topology file.