How it works…

The os_image module will take the user-defined name of the image as a parameter. We will define the container format and disk format. The ID parameter takes a UUID, which has to be unique. We can manually supply one or use Ansible's to_uuid filter. If we are supplying one, then the easiest way to get a UUID in the correct format is to use the uuidgen command on shell. Lastly, we specify the path of the downloaded qcow2 image on our local system. This qcow2 image will be uploaded to OpenStack and an image will be created from which we can boot compute instances.

Get Ansible 2 Cloud Automation Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.