Everyone knows it's a Good Idea™ to use a configuration management system (e.g. Puppet, Chef) to manage your Drupal infrastructure. But many people (myself included) have run into a wall of #wtfmoments when trying to learn the vagaries of traditional CM systems and their vendor-specific syntaxes.
In 2012, Ansible was released, enabling normal human beings to manage their servers with an easy, but powerful, CM system that uses YAML (just like Drupal 8!) to define configuration and Jinja2 (very much like Twig!) for templates. Not only that, but Ansible is also an incredibly simple and very flexible Drupal deployment and continuous delivery tool.
Learn how you can use Ansible to manage your infrastructure—including local development environments—and stop letting servers and deployments get in the way of development.
4. This presentation
1. Drupal deployments are hard
2. Ansible is simple and powerful
3. Ansible is great for Drupal deployments
(and a lot more)
5. In the Beginning…
• Local Dev: MAMP/WAMP/XAMPP
• Deployments: git
pull
&&
drush
updb
• Plus 15 other manual deployment steps…
• New servers: manual provisioning
8. _______________________________________
/
I
once
had
to
go
to
a
sysadmin
with
a
bottle
of
whiskey
to
get
a
deploy.
/
-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐
^__^
(oo)_______
(__)
)/
||-‐-‐-‐-‐w
|
||
||
@itababy at AnsibleFest NYC, 2014
16. _______________________________________
/
It
should
take
less
time
to
rebuild
a
server
than
to
log
in
and
fix
it.
/
-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐-‐
^__^
(oo)_______
(__)
)/
||-‐-‐-‐-‐w
|
||
||
http://www.slideshare.net/ItamarHassin/monitordriven-development-using-ansible-34920480
18. Puppet Chef Salt Ansible
Initial release 2005 2009 2011 2012
Configuration
Language DSL Ruby/DSL YAML YAML
Template
Language ERB ERB Jinja2 Jinja2
Agentless ✓
Simple ad-hoc
task execution ✓ ✓
GitHub ★s* 2,239 2,729 3,531 6,202
*As of 2014/06/02. Just a reference point. Stars don’t mean much in the grand scheme of things ;-)
Current solutions
19. Puppet Chef Salt Ansible
Initial release 2005 2009 2011 2012
Configuration
Language DSL Ruby/DSL YAML YAML
Template
Language ERB ERB Jinja2 Jinja2
Agentless ✓
Simple ad-hoc
task execution ✓ ✓
GitHub ★s* 2,239 2,729 3,531 6,202
Just like Drupal 8!
Just like Twig!
*As of 2014/06/02. Just a reference point. Stars don’t mean much in the grand scheme of things ;-)
Current solutions
20. Puppet Chef Salt Ansible
Initial release 2005 2009 2011 2012
Configuration
Language DSL Ruby/DSL YAML YAML
Template
Language ERB ERB Jinja2 Jinja2
Agentless ✓
Simple ad-hoc
task execution ✓ ✓
GitHub ★s* 2,239 2,729 3,531 6,202
Just like Drupal 8!
Just like Twig!
*As of 2014/06/02. Just a reference point. Stars don’t mean much in the grand scheme of things ;-)
#HugOps
Current solutions
21. Who uses ?
(and me: Server Check.in, Hosted Apache Solr, Midwestern Mac, LLC)
27. Inventory
[lamp]
example.com
!
[lamp:vars]
ansible_ssh_user=johndoe
ansible_ssh_port=2222
(save in /etc/ansible/hosts)
Group name
Hosts in group
(just one, for now)
Variables
(for all hosts in group)
35. Playbook
-‐-‐-‐
-‐
hosts:
lamp
sudo:
yes
!
tasks:
-‐
apt:
update_cache=yes
!
-‐
include:
web.yml
(save as playbook.yml)
Name of group/host defined in inventory
36. Playbook
-‐-‐-‐
-‐
hosts:
lamp
sudo:
yes
!
tasks:
-‐
apt:
update_cache=yes
!
-‐
include:
web.yml
(save as playbook.yml)
Name of group/host defined in inventory
Include the playbook
we created earlier
67. for Drupal
Deployment Victory!
• Easy to get started
• OH: “it works on my machine”
• sysadmin burnout
• You’ll actually enjoy it!
68. for Drupal
Deployment Victory!
• Easy to get started
• OH: “it works on my machine”
• sysadmin burnout
• You’ll actually enjoy it!
• …but BEWARE THE GOLDEN HAMMER!
70. • Ansible ♥’s:
• Packer
• Docker
• [AWS|DO|Linode|Rackspace|etc.]
Things I wanted to cover,
but didn’t have time
71. • Ansible ♥’s:
• Packer
• Docker
• [AWS|DO|Linode|Rackspace|etc.]
• Delegation, notifications, ad-hoc commands, async
commands, rolling updates, prompts, Ansible Vault, wait_for,
forks, dynamic inventory, and oh-so-much-more…
Things I wanted to cover,
but didn’t have time