Last active
May 25, 2017 13:46
-
-
Save srebrny/6f561b036ca0d7d0e38d91b617bb7aec to your computer and use it in GitHub Desktop.
Gist for initialization basic structure in ansible playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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