Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gist for initialization basic structure in ansible playbook
#!/bin/bash
# Here is a directory layout
# ├── filter_plugins
# ├── inventories
# │ ├── develop
# │ │ ├── group_vars
# │ │ │ ├── common.yml
# │ │ │ ├── default.yml
# │ │ │ ├── developer.yml
# │ │ ├── proxy.yml
# │ │ │ ├── docker.yml
# │ │ │ └── security.yml
# │ │ ├── hosts
# │ │ └── host_vars
# │ │ ├── common.yml
# │ │ ├── default.yml
# │ │ ├── developer.yml
# │ │ ├── docker.yml
# │ │ ├── proxy.yml
# │ │ └── security.yml
# │ └── production
# │ ├── group_vars
# │ │ ├── common.yml
# │ │ ├── default.yml
# │ │ ├── developer.yml
# │ │ ├── docker.yml
# │ │ └── security.yml
# │ ├── hosts
# │ └── host_vars
# │ ├── common.yml
# │ ├── default.yml
# │ ├── developer.yml
# │ ├── docker.yml
# │ └── security.yml
# ├── library
# ├── README.md
# ├── roles
# │ ├── common
# │ │ └── main.yml
# │ ├── developer
# │ │ └── main.yml
# │ ├── docker
# │ │ └── main.yml
# │ ├── proxy
# │ ├── security
# │ │ └── main.yml
# │ └── setup
# └── Vagrantfile
# Here is a link for anisble documentation
# http://docs.ansible.com/ansible/playbooks_best_practices.html#alternative-directory-layout
# We create directories for inventories, library, filters, roles
mkdir -p {library,filter_plugins,roles/{common,security,developer,setup,proxy,docker}/,inventories/{production,develop}/{group_vars,host_vars}/}
# Create some required files
touch {inventories/{develop,production}/hosts,inventories/{develop,production}/{group_vars/{common.yml,developer.yml,security.yml,docker.yml,proxy.yml,default.yml},host_vars/{common.yml,developer.yml,security.yml,docker.yml,default.yml}},roles/{common,developer,security,proxy,docker}/main.yml}
# Create default playbooks file.
touch provision.yml developer.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment