Preparing Ansible to work with OpenStack
OpenStack exposes a set of web APIs that can be used to manage resources. In order to interact with these APIs, Ansible needs to authenticate with OpenStack. The shade
Python library helps in authenticating with the OpenStack server. So let's go ahead and install the required dependency using the following command:
# pip install shade
How to do it…
We need to set up a few environment variables on the server that we will execute the Ansible code from. These variables will be required for authenticating with OpenStack. An easy way to do this is to download the environment variable file from the OpenStack dashboard (called Horizon
).

From the Horizon dashboard, go to API Access
from the left sidebar. From here, click on the Download OpenStack RC File
| OpenStack RC File (Identity API v3)
file. This file consists of all the required variables that we need to set up in the environment. We can just execute this Bash script and all the variables will be exported...