Building the Ansible playbook

As we saw in Chapter 13, Ansible for Administration, depends on a YAML file to contain everything you will need to execute against hosts in the inventory. In this case, we will instruct the playbook to establish a local connection to the shade library on the automation server, and provide the playbook with the keystonerc_admin credentials that help shade to send requests to our OpenStack server.

The playbook script is as follows:

---- hosts: localhost  vars:      os_server: '10.10.10.150'  gather_facts: yes  connection: local  environment:    OS_USERNAME: admin    OS_PASSWORD: access123    OS_AUTH_URL: http://{{ os_server }}:5000/v3    OS_TENANT_NAME: admin    OS_REGION_NAME: RegionOne    OS_USER_DOMAIN_NAME: Default    OS_PROJECT_DOMAIN_NAME: ...

Get Hands-On Enterprise Automation with Python. now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.