ansible-provision is part of suite of ansible roles that provide a common interface for provisioning infrastructure.
While there is a slant towards AWS services many interfaces support vmware vCenter and Azure.
- Convention over configuration - Require as minimal configuration as possible, lookup ids in the background and use conventions whenever possible
- Prefer declarative template (e.g. AWS Cloudformation / Azure Resource Templates) to direct API calls
- Use cloud-init extensively to setup volumes and bootstrap instances for deployment.
ansible-deploy is used to generate cloudinit config files for bootrapping instances once they have been provisioned.
ansible-deployshares many of the same interfaces as
ansible-provisionso that for example an EBS volume can be provisioned and then formatted and mounted it into the filesystem on startup.
systools provides many helpers and bootstraping tools (systools will be installed by ansible-deploy if it is missing)
- fireviz is a tool to convert Graphviz firewall diagrams into Cloudformation/ARM templates
- (Optional) ansible-dependencies provides RPM, DEB and pip packages that simplify the installation of ansible with all the required dependencies to use cloud and networking modules
- (Optional) ansible-run provides CLI tools for easily running and testing ansible playbooks using ansible-dependencies.
Quickstart with Virtual Box
Install Virtual Box and create a VM named "Ubuntu_Template"
Create an inventory file under
target: virtualbox template: Ubuntu_Template
Install the CLI:
pip install ansible-provision
Provision an instance:
ansible-provision --hostname test_instance
|aws||Generates and then executes CloudFormation templates for each ansible group|
|azure||Generates Azure Resource Templates and then executes them|
|vmware||Creates VM's using the native ansible VMware modules and vCenter / vSphere|
|vmware-fusion||Clones VM's using the
|VirtualBox||Clones VM's using the
Both ansible-provision and ansible-deploy can be pinned to specific versions at an inventory level, rather than at an installation level. This works by checking out specific tags or branches just before running the role:
ansible_deploy_version: 2.9.2 ansible_provision_version: 4.1
Sample Folder Structure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
├── cloudformation # applies to AWS only │ └── iam.cf ├── firewall │ ├── all.gv │ └── mapping.yml ├── inventory │ ├── group_vars │ │ ├── all │ │ ├── app │ │ ├── db │ │ ├── dev │ │ ├── test │ │ └── web │ └── hosts ├── play.yml └── roles └── requirements.yml