https://github.com/anmolnagpal/ansible-boilerplate
Boilerplate code for Ansible
https://github.com/anmolnagpal/ansible-boilerplate
ansible ansible-playbook boilerplate boilerplate-template devops
Last synced: about 1 year ago
JSON representation
Boilerplate code for Ansible
- Host: GitHub
- URL: https://github.com/anmolnagpal/ansible-boilerplate
- Owner: anmolnagpal
- Created: 2017-11-17T20:07:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-24T09:00:36.000Z (over 7 years ago)
- Last Synced: 2025-04-07T21:12:26.106Z (about 1 year ago)
- Topics: ansible, ansible-playbook, boilerplate, boilerplate-template, devops
- Language: Makefile
- Homepage: https://www.ansible.com/
- Size: 146 KB
- Stars: 15
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README

> Ansible Boilerplate Code
#### Read More
- [Boilerplate Code - https://en.wikipedia.org/wiki/Boilerplate_code](https://en.wikipedia.org/wiki/Boilerplate_code)

## Directory structure
```
├── _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
```
---
## ansible.cfg
This is a project specific configuration file to configure Ansible. [View](ansible.cfg)
to see a more detailed explanation of the default settings provided by this
project.
#### Read More
- [Ansible.cfg - http://docs.ansible.com/ansible/intro_configuration.html](http://docs.ansible.com/ansible/intro_configuration.html)
---
### group_vars
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 our `dev-api-backend` hosts file in the previous example.
#### Read More
- [Variables - http://docs.ansible.com/ansible/playbooks_variables.html](http://docs.ansible.com/ansible/playbooks_variables.html)
---
## inventories
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
```
#### Read More
- [Inventory - http://docs.ansible.com/ansible/intro_inventory.html](http://docs.ansible.com/ansible/intro_inventory.html)
---
## notes
This is where you can add your notes for things like manual configuration.
---
## roles
This is where you can add your custom Ansible [roles](http://docs.ansible.com/ansible/playbooks_roles.html#roles) for usage by your playbooks.
#### Read More
[Roles - http://docs.ansible.com/ansible/playbooks_roles.html#roles](http://docs.ansible.com/ansible/playbooks_roles.html#roles)
---
## logs
By default this is just a symlink to `./_logs/ansible-log.json`
#### Read More
- [Playbooks - http://docs.ansible.com/ansible/playbooks.html](http://docs.ansible.com/ansible/playbooks.html)
---
## 👬 Contribution
- Open pull request with improvements
- Discuss ideas in issues
- Reach out with any feedback [](https://twitter.com/anmol_nagpal)