This repository is the skeleton to do infrastructure as a code with Ansible + Docker. You will have
- Ansible playbooks in all yml files on root repository
- Sample inventory files for each service in
inventories
directory - Sample variable files with heavily comment for each service in
vars
directory - Sample configuration files for each service in
files
directory - Documents how to use each role and tutorial in
docs
directory - Roles that will separate into each Ansible Galaxy repository. You can see all the roles in
galaxy-requirements.yml
- Docker 1.10 or up
- Docker Machine 0.7.0 or up
- Ansible 2.1 or up
- Make sure that you can ssh to target machine
- Fork this repository and make your own configuration from example files
- You can see all my galaxy role in
galaxy-requirements.yml
file. To install or update all roles, run the command
# Use -f to force reinstall roles
ansible-galaxy install -f -r galaxy-requirements.yml
- You shouldn't have to edit any file in this repository. This make you easier to maintain and update playbook from upstream
- If you find yourself that you have to edit any file in this repository so it means that you have to send that pull request to me :P
- To update playbook from upstream. Run below commands
# http://stackoverflow.com/questions/7244321/how-do-i-update-a-github-forked-repository
# Add the remote, call it "upstream":
git remote add upstream https://github.com/winggundamth/ansible-wing-playbook.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Merge upstream/master to your forked repository
git merge upstream/master
According to Variable Precedence: Where Should I Put A Variable?. Order of variable priority would be (The last listed variables win)
- roles/*/default/main.yml
- group_vars/all
- group_vars/group_name
- host_vars/all
- host_vars/group_name
- vars/*.yml (as specific vars_file in inventory file)
- extra vars with -e with
ansible-playbook
command
So from above priority. In use case you want to specific something like the memeory of elastic search and will be difference on each cluster. You should create default allocate memory variable in group_vars/all
file and specific memory for each cluster in group_vars/group_name
. Don't forget to change group_name file name to your group name. And don't forget to remove or comment that variable in vars/*.yml
since it will overwrite and win the priority.
- Host preparation
- Install Docker
- Manage Docker Machine
- Manage nginx container
- Install Docker Compose
- Run apt-cacher-ng container
- Manage Mongo container
- Manage ElasticSearch container
- Manage Graylog container
The MIT License (MIT)