Giter Site home page Giter Site logo

ansible-openstack-api's Introduction

ansible-openstack-api

Ansible Version

NOTE: Tested with Ansible 1.9.4 but should work with 2.x, though many of these tasks could be easily performed via the 2.x os_ modules instead.

Demo

In-depth screencast demonstrating this playbook: https://youtu.be/HV9MN3tNzvg

About

This playbook uses Ansible URI module to communicate with OpenStack APIs using JSON.

This playbook grabs an authentication token from the OpenStack Identity service and reuses that through several tasks as admin. It creates a project and user based on defined variables then revokes the token and authenticates as the new user to complete the remainder of the tasks. For a project I was working on we were stuck using Ansible 1.9.x so could not take advantage of some of the new 2.x modules. However, this playbook runs considerably faster than using shell/command modules or a bash script with equivalent CLI command.

Advantages

Some of the advantages of this approach over OpenStack CLI commands or even what modules do work is that authentication does not need to be provided on every single CLI invocation. Reusing then revoking the token is much faster so as the number of tasks invoked increases so does the efficiency of this approach. The API also returns native JSON which makes accessing object data a snap, rather than using a shell or command module and painstakingly trying to awk/grep or otherwise get at the data you need.

Disadvantages

The main issue is how sensitive the formatting of JSON payload needs to be in the URI module for the OpenStack APIs to be happy. I tried using native yaml to pass to the OpenStack API but couldn't get it to cooperate.

Future

I plan on enhancing this with additional actions and possibly converting it into a role but want to evaluate options and effects of Ansible 2.x.

Related

This playbook is only a small subset of a larger set of work which involves going on to create instances and a dynamic inventory and installing OpenShift. For more details see https://github.com/rhtconsulting/rhc-ose/tree/openshift-enterprise-3/rhc-ose-ansible

ansible-openstack-api's People

Contributors

vvaldez avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.