Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create Ansible Directory Layout Based on Ansible Document
# Create Ansible directory layaout based on Ansible Documentation
# inventory file for production servers
touch production
# inventory file for staging environment
touch staging
# here we assign variables to particular groups
mkdir group_vars
touch group_vars/group1
# if systems need specific variables, put them here
mkdir host_vars
touch host_vars/hostname1
# if any custom modules, put them here (optional)
mkdir library
# if any custom filter plugins, put them here (optional)
mkdir filter_plugins
# master playbook
touch site.yml
# playbook for webserver tier
touch webservers.yml
# playbook for dbserver tier
touch dbservers.yml
# role directories
mkdir roles
cd roles
## this hierarchy represents a "role"
mkdir common
cd common
# tasks file can include smaller files if warranted
mkdir tasks
touch tasks/main.yml
# handlers file
mkdir handlers
touch handlers/main.yml
# files for use with the template resource
# templates end in .j2
mkdir templates
touch templates/dummy.j2
# files for use with the copy resource
# script files for use with the script resource
mkdir files
touch files/dummy.txt
# variables associated with this role
mkdir vars
touch vars/main.yml
# default lower priority variables for this role
mkdir defaults
touch defaults/main.yml
# role dependencies
mkdir meta
touch meta/main.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.