1. WAG the Blog*
Using WordPress, Ansible, and Git to Build Your Website
WordCamp Atlanta 2016 || Evan Volgas || Developer Track
* Ha! A pun.
2. Who the heck is this guy?
Evan….
• Recently started as a data engineer at MailChimp
• Has used WordPress off and on for about 6-7 years
• Has used Ansible for about a two years now
• Probably drinks more coffee than you*
• Definitely has written more bad code than you**
More Snark
@EvanVolgas
Less Snark
https://evan.is/
* No seriously, he has a problem
** See above
3. Important Disclaimers
I believe….
• Google Exists
• You can use it
• Reading code in slides is boring
• Working with servers is fun
• Elvis is still alive*
* You’re not fooling anybody Matt… or should I say Elvis?
4. Who cares about servers? (bias / opinion alert)
Think about the question:
How does the internet work?*
https://ma.ttias.be/the-best-tech-question-to-ask-in-a-job-interview/
My opinion: As professionals who earn a living on the internet, we owe it to ourselves
and the people we work with to understand the technologies we are using on a deep
level.
That includes understanding more about servers than most people would ever stop
and think about in the first place.
* Laws, sausages, and software… all things you don’t want to see get made
5. Ansible
• Ansible is OSS that was written to make configuring
and managing servers less of a pain in the neck
• The name Ansible comes from a sci-fi novel by
Ursula K. Le Guin. The term was popularized by
Orson Scott-Card in Ender’s Game.
• In many sci-fi books, an Ansible is a device that can
remotely control large fleets of ships all across the
galaxy
• In our world, Ansible can connect to an arbitrarily
large number of servers over SSH and run
commands on them, commands that you yourself
could run if you were SSH’d into all of the machines
yourself
We read sci-fi all day. It’s a hard NOC life for those of us in software
6. How Ansible Works in a Nutshell
Ansible…
• Runs playbooks or “plays” against groups of servers
• Each play may be compromised of one or more “roles.” Roles are groups of
things you want to do on your servers and are usually where all the work in
Ansible really happens
• Appropriate role scoping is subjective but an example of a role might be
“Install and configure Nginx” for example or “Install and configure IP Tables.”
Don’t worry about defining an appropriate scope for a role just yet. Instead,
read Other People’s Code and start forming opinions on what works and what
doesn’t
• Every role may have variables, tasks, templates, and/or defaults associated
with it. Here again, OPC will be very helpful.
• The hosts in your Ansible inventory can also have variables assigned to them.
This is some serious secret sauce right here and you should definitely pay
attention to this
Using footnotes in slides is a terrible idea isn’t it?
7. Ansible: Examples / Discussion
• TLR*: https://github.com/evanv/tlr
• Trellis: https://github.com/roots/trellis
• WordPress Ansible: https://github.com/lamosty/
wordpress-ansible
• AnsiPress: https://github.com/codeablehq/AnsiPress
• Ansible-WordPress: https://github.com/Oefenweb/
ansible-wordpress
* Whoever owns this repo is probably very smart, funny, attractive, & great at at giving presentations
8. Ansible: Examples Review
Roles may include variables, which
have different levels of precedence
For example, host variables “win”
against role defaults
See http://docs.ansible.com/
ansible/playbooks_variables.html
for info about the rules
You can (and often do) break your
inventory into different host groups
that you can target with different
playbooks
Can you believe they let this guy speak at WordCamp?
9. Git
• Git is an open source Version Control System (VCS)
• Git is distributed — developers have full copies of the
code and its history on their local environments and
then push changes to a central shared location
• Workflows (eg https://www.atlassian.com/git/tutorials/
comparing-workflows/centralized-workflow and http://
blog.endpoint.com/2014/05/git-workflows-that-
work.html) and opinions about them abound.
• Ignore the flame wars. Just do what works for you and
your team.
He probably doesn’t know anything about Linux either
10. WordPress and Git
• If you read one article, read this: http://
stevegrunwell.github.io/wordpress-git/
• If you read two articles, read https://
deliciousbrains.com/storing-wordpress-in-git/
• If you read three articles, read https://
markjaquith.wordpress.com/2011/06/24/wordpress-
local-dev-tips/
* Whatever you do, don’t read four articles. Four is nature’s limit. Watch Monty Python. That shalt read three articles. Five is right out.
11. What’s Git Got to Do with This?
• You *definitely* want to keep your Ansible
playbooks and roles under version control
• You can use Ansible to install Git on your servers.
• You can also (and will, probably, once you suffer
the pain of learning to use them) use Ansible in
connection with CI tools like Travis / Circle /
BuildBot / etc.
Jedi mind trick? Nope. Continuous integration. Not sure what that is? See slide 4.
12. Why are we here
again?
• You should absolutely take a look at Trellis: https://github.com/roots/
trellis and VVV (https://github.com/Varying-Vagrant-Vagrants/VVV)
• You should also take a look at provision.sh in VVV (https://
github.com/Varying-Vagrant-Vagrants/VVV/blob/develop/provision/
provision.sh) and compare that to Trellis. Quite a bit different, no?
But awfully similar too.
* Learning how the internet works is a lot like learning emacs except people who know how the internet works still get invited to parties sometimes
• The internet is not magic. But it is
complicated. And the more you work
with servers, the more you will be
exposed to its complexity and the
more you will start* to understand it
13. The moment we’ve all been waiting for….
Let’s provision a server!
Where’s Wapuu?
14. Concluding remarks
• Earlier I mentioned role scoping in Ansible and also claimed that
you definitely want your Ansible scripts in Git
• Let’s decimate look at OPC https://www.digitalocean.com/
community/tutorials/how-to-automate-installing-wordpress-on-
ubuntu-14-04-using-ansible
• Your server config will change.
You’ll make mistakes. Make
your config a living document.
Use Git.
• https://github.com/MisfitIdeas/
wag-the-blog
Hell is OPC… unless OPC is Rich Hickey’s