Skip to content

Instantly share code, notes, and snippets.

@jhoelzel
Last active February 9, 2022 23:09
Show Gist options
  • Save jhoelzel/1bafe868a76c5646a45ad6616a2c1a07 to your computer and use it in GitHub Desktop.
Save jhoelzel/1bafe868a76c5646a45ad6616a2c1a07 to your computer and use it in GitHub Desktop.
Ansible Create Alternative Directory Layout Structure
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_best_practices.html#id12
inventories/
production/
hosts # inventory file for production servers
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
hostname1.yml # here we assign variables to particular systems
hostname2.yml
staging/
hosts # inventory file for staging environment
group_vars/
group1.yml # here we assign variables to particular groups
group2.yml
host_vars/
stagehost1.yml # here we assign variables to particular systems
stagehost2.yml
library/
module_utils/
filter_plugins/
site.yml
webservers.yml
dbservers.yml
roles/
common/
webtier/
monitoring/
fooapp/
mkdir -p inventories/{production,staging}/{group_vars,host_vars} && touch inventories/{production,staging}/hosts && mkdir -p group_vars host_vars library module_utils filter_plugins && mkdir -p roles/common/{tasks,handlers,templates,files,vars,defaults,meta,library,module_utils,lookup_plugins} && touch site.yml roles/common/{tasks,handlers,templates,files,vars,defaults,meta}/main.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment