Publishing a role
Now we know how easy it is to download a role, let's look at how we can contribute back to the community by creating a role. In the last few chapters, we have been using Ansible to install Docker. So let's use that as our base and extend the role to support Ubuntu and have it install the Docker CE Edge release rather than the stable one.
Creating the docker role
To start off with, we need the basic files; to get these, run the following command where you normally store your code:
$ ansible-galaxy init ansible-role-docker
This will give us the directory and file structure we need for our new role; we can now make a start on creating the role.
Variables
We are going to start with the files in the vars
folder; we are going to be keeping the vars/main.yml
file blank and adding two new files starting with vars/RedHat.yml
:
--- # vars file for ansible-role-docker docker: gpg_key: "https://download.docker.com/linux/centos/gpg" repo_url: "https://download.docker.com/linux/centos/docker...