Driving OpenStack via Ansible

Doug Hellmann

OpenStack-Atlanta, January 2017

https://github.com/dhellmann/presentation-ansible-openstack

Tools

  • ansible 2.x
  • shade
  • python-openstackclient

ansible over-simplified

Create a playbook
to map roles
to inventory and
run idempotent configuration tasks.

shade over-simplified

Python client library for OpenStack with the goal of being interoperable between cloud deployments.

python-openstackclient over-simplified

Python command line tool for scripting management of OpenStack resources.

Installing

$ git clone https://github.com/dhellmann/presentation-ansible-openstack.git
$ cd presentation-ansible-openstack/ansible
$ vi keys.yml
$ virtualenv --python=python2.7 venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ ansible-galaxy install -r requirements.yml

Configuring 1/3

clouds.yml:
clouds:
  dreamcompute:
    auth:
      username: douhel2
      password: NO_PEEKING
      project_name: dhc1246820
      auth_url: https://iad2.dream.io:5000

Configuring 2/3

keys.yml:
key_name: douhel2-iad2
private_key_file: ~/.ssh/dreamcompute-douhel2.pem

Configuring 3/3

shell:
export OS_CLOUD=dreamcompute

Verify Auth Setup

$ openstack server list
+------+--------+--------------+
| Name | Status | Image Name   |
+------+--------+--------------+
| dev1 | ACTIVE | Ubuntu-16.04 |
| vpn  | ACTIVE | Ubuntu-14.04 |
| znc  | ACTIVE |              |
+------+--------+--------------+

ZNC Demo

znc.yml

  • Launching a server
  • Dynamic Inventory
  • Security Groups and Rules
  • Deploying Software

Devstack Demo

clouddev.yml

  • Launching a server, with a volume
  • Adding swap
  • Cloning git repos
  • Creating a local login script
https://github.com/dhellmann/presentation-ansible-openstack
http://docs.ansible.com/ansible/list_of_cloud_modules.html
http://docs.openstack.org/infra/shade/