Skip to content

Instantly share code, notes, and snippets.

@srebrny
Last active May 25, 2017 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srebrny/6f561b036ca0d7d0e38d91b617bb7aec to your computer and use it in GitHub Desktop.
Save srebrny/6f561b036ca0d7d0e38d91b617bb7aec to your computer and use it in GitHub Desktop.
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