A collection of Ansible scripts and templates used to deploy systems used by OpenSRP. We use Ansible's recommended alternative directory layout.
To run the stuff herein, you need Ansible. To use Ansible you might need pycrypto.
To build pycrypto, you need the latest python (2.1 <= ver <= 3.3) development libs & headers.
Stick with python v2.7 for now. It's the current status quo.
In a nutshell, if you're using debian/ubuntu :- apt-get install python-dev
For local "dev" deployments, you will need to install Virtualbox. You'll need the password used to encrypt sensitive info in this repo.
Clone this repository with its Git submodules:
git clone --recursive [email protected]:opensrp/playbooks.git && cd playbooks
Make sure all pip requirements are installed by running the following command. We recommend you do this in a dedicated Python virtual env:
pip install -r requirements.txt
Install the Ansible Galaxy requirements using these commands:
mkdir -p ~/.ansible/roles/opensrp
ansible-galaxy install -r requirements.yml -p ~/.ansible/roles/opensrp
Copy over your inventory files into a new directory called inventories
. Note that we have inventories
in the .gitignore file. We recommend you track them in a seperate private git repository. Please do not make pull requests to this repository with inventory files that might expose aspects of your infrastructure that you don't want exposed.
We recommend you use the following directory structure:
Split your inventories based on DevOps clients, and their server environments.
Example DevOps clients include:
- personal (for your personal inventories)
- tb-reach
- zeir
And environments:
- production
- preview
- staging
The inventory directory structure, hence, looks like:
inventories/
│── [DevOps Client 1]
│ │── [Environment 1]
│ │ │── group_vars
│ │ │── hosts
│ │ └── host_vars
│ .
│ .
│ .
│ └── [Environment m]
│ └ ...
.
.
.
└── [DevOps Client n]
└ ...
Each environment directory contains a hosts
file that's used to group host_vars
into group_vars
and group_vars
into other group_vars
. Please avoid setting ansible variables in that file.
Packer allows for packaging of machine/container images from Ansible scripts like the ones defined in this repository. To run any of the packer files defined in this repository, do:
packer build -var-file=inventories/<DevOps client>/<environment>/packer/<name of setup>/<name of variant>.json packer/<name of setup>.json