2. Provisioning your environment
Rich Gwozdz, Spatial Development International
Provisioning includes:
• Installing software (Apache, PGRestAPI, Postgres)
• Adding data (restore databases)
• Configuration (configure Apache)
• Anything needed to run your server application
Often executed via SSH session and bash scripting:
# Install Postgres
$ apt-get postgresql-9.4-postgis-2.1
…
…
# Trust Connections
$ sudo nano /etc/postgres/9.4/main/pg_hba.conf
3. Provisioning your environment
Rich Gwozdz, Spatial Development International
You can provision with bash alone; requires careful scripting
• variables
• conditionals
• http requests
• file transfers
Enter Provisioning Frameworks:
• ease provisioning script development
• provided tested, maintained modules
• provide a sharing infrastructure
4. Provisioning your environment
Rich Gwozdz, Spatial Development International
Ansible: simple & straightforward
• simple and straightforward
• YAML
• SSH
6. Provisioning your environment
Rich Gwozdz, Spatial Development International
hosts: A group of target
servers listed in:
/etc/ansible/hosts
[ec2s]
123.4.5.6
Ansible playbook
7. Provisioning your environment
Rich Gwozdz, Spatial Development International
var_files: files containing
variables/settings to be used
in all task
Ansible playbook
8. Provisioning your environment
Rich Gwozdz, Spatial Development International
role: a role is a set of
tasks that address a discrete
unit of work. Easily shared
across playbooks
Ansible playbook
13. Provisioning your environment
Rich Gwozdz, Spatial Development International
Ansible Mangement Node
• Separate server: configured for SSH with target hosts
• Local machine: but requires config changes - could get out of sync
• Vagrant VM: distribute it via Git!
14. Provisioning your environment
Rich Gwozdz, Spatial Development International
Vagrant VM as Ansible Mangement Node
Vagrant provides “lightweight,
reproducible, and portable development
environments” (i.e., server VMs) with
VirtualBox and some other goodies
16. Provisioning your environment
Rich Gwozdz, Spatial Development International
Vagrant VM as Ansible Mangement Node
Why?
• Vagrant VMs are distributable by Git repos
• Everyone’s Management node would be identical
• Can double as a local deployment of your environment
Cloned Git repo
17. Provisioning your environment
Rich Gwozdz, Spatial Development International
Vagrant VM as Ansible Mangement Node AND Target host
Local dev environment = deployment environment
Cloned Git repo
18. Provisioning your environment
Rich Gwozdz, Spatial Development International
Additional Ansible goodies
Great AWS support
• Create, delete EC2
• Create, delete Security Groups
• Set Elastic IPs
• Set EC2s as provisioning target hosts via tags rather than hard-code
IPs
Ansible Galaxy
• Hub for find, reusing, sharing Ansible roles (kind of like npm)