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 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.