Simple Ansible Directory Structure Creation

Ansible

You can quickly create an Ansible Directory structure using something like the following example. In my example the Ansible directory is just within my Home Directory, I then have a directory called “Plays” where the Ansible Play files are stored and another one called “Roles” where the roles are stored. If say we wanted to create a new Play called “netdata”, the following could be used to set up the framework ready for use:

cd ~/ansible

export PLAYNAME=netdata

mkdir plays/$PLAYNAME
touch plays/$PLAYNAME/$PLAYNAME.yml

mkdir -p roles/$PLAYNAME/{common,files,handlers,tasks,templates}
touch roles/$PLAYNAME/tasks/main.yml

Leave a Reply

Your email address will not be published. Required fields are marked *