Our goal is to create and host on GitHub a generic Ansible role. In the example below we will create role for installing and configuring VirtualBox.

  • Create a github repository ansible-role-virtualbox

  • Clone the repository

$ git clone [email protected]:qba73/ansible-role-virtualbox.git 
  • Generate Ansible role
$ ansible-galaxy init ansible-role-virtualbox --force

The –force flag will overwrite ansible role and add generted code

  • Update repository meta-data and information in the README file

  • Add and commit generated code for our new role

$ cd ansible-role-virtualbox
$ git add .
$ git commit -m 'Initial project setup'
$ git push origin master

At this stage we are ready to start coding the role and adding tests.