Ansible Boilerplate Code
├── _inventory
│ └── hosts.ini
│
├── _logs
│ └── facts
│ └── retry
│ └── ansible-log.json
│
├── _ssh
│ └── web.ssh.config
│
├── _ssl
│
├── group_vars
│ ├── all
│ └── dev-api-backend
│
├── notes
│ └── tags.md
│
├── roles
│ └── common
│ └── hardening
│ └── docker
│ └── docker-compose
│
├── ansible.cfg
│
└── dev-bastion.yml
This is a project specific configuration file to configure Ansible. View to see a more detailed explanation of the default settings provided by this project.
This directory contains yaml files which correspond to a group name, and tells Ansible to load the variables for the hosts in that group.
Example structure:
└── group_vars
├── all
│ └── global.yml
└── dev-bastion
└── config.yml
all
- is a Ansible group, where it will be loaded for all hosts.dev-api-backend
- is a user defined group of hosts, we defined this in ourdev-api-backend
hosts file in the previous example.
This is where you should put the list of hosts for Ansible to connect to. It
Example:
├── hosts.ini
We have a file called hosts.ini
, but if you have a lot of environments,
instead of develop
, you might call it dev-api-backend
or
dev-db-mongodb
, etc.
In it you might define it like so:
[dev-api-backend]
10.250.0.0 = Env=dev EcType=dev_api_backend EcName=dev_api_backend-dev-0-a Az=a K=0 Nr=0 PublicIp=54.00.00.00
IType=t2.medium Region=eu-west-1 PrivateIp=10.00.00.00 PrivateDns=ip-10-00-00-00.eu-west-1.compute.internal
[all:children]
dev-api-backend
This is where you can add your notes for things like manual configuration.
This is where you can add your custom Ansible roles for usage by your playbooks.
Roles - http://docs.ansible.com/ansible/playbooks_roles.html#roles
By default this is just a symlink to ./_logs/ansible-log.json