In this section, we will now create the playbooks and roles to add the OpenStack feature of provisioning Docker compute node(s) as a hypervisor to your cloud. When creating Ansible automation code for something of this nature, I typically like to create multiple tasks broken up into separate roles. This format allows you to reuse the roles created with other playbooks. We will end up with four playbooks and six roles to automate the steps outlined in the previous section. Each role will be broken up into its own area within this section of the chapter. At the end, we will recap the playbooks consuming those roles.
The first role that we will create will include the tasks needed to install Docker on the new compute node(s). The name of the file will be main.yml
located within the role directory named install-docker/tasks
. The contents of this file will be as shown:
--- - name: Install additional packages apt: name={{item}} state=present with_items...