Now that we have our role, we can test it. To do this, we will need a playbook, inventory, and a requirements file, as well as a CentOS and Ubuntu server. Run the following commands to create the files you need:
$ mkdir docker$ cd docker$ touch production requirements.yml site.yml Vagrantfile
The inventory file, production, should look as follows:
centos ansible_host=10.20.30.10.nip.io ubuntu ansible_host=10.20.30.20.nip.io ansible_python_interpreter=/usr/bin/python3[docker]centosubuntu[docker:vars]ansible_connection=sshansible_user=vagrantansible_private_key_file=~/.ssh/id_rsahost_key_checking=False
Our requirements.yml file contains just our Docker role:
- src: "russmckendrick.docker"
Our playbook, the site.yml file, should ...