whoami
●
(PHP) Developer Advocate at
DigitalOcean
●
Working with PHP and Linux
for 10+ years
●
Author of Vagrant Cookbook
and phansible.com
Slide 3
Slide 3 text
What to expect from this talk
1. Vagrant: quick recap
2. Ansible Overview
3. Writing Playbooks
4. Standalone Ansible
Slide 4
Slide 4 text
VAGRANT:
QUICK RECAP
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
ANSIBLE
OVERVIEW
Slide 7
Slide 7 text
Ansible Overview
●
Simple and Straightforward
●
Human-readable automation
language
●
Agentless - needs only SSH
●
Extensive list of built-in modules
●
Used by Twitter, Atlassian, EA,
Spotify, even NASA!
Slide 8
Slide 8 text
Installation
$ brew update
$ brew install ansible
$ sudo apt-add-repository -y ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install -y ansible
Detailed installation instructions: do.co/ansible-docs
Mac OSX
Ubuntu
*Windows is not officially supported as controller machine.
Ansible as Provisioner
#Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise64"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "playbook.yml"
end
end
Conditionals
- name: "shutdown Debian flavored systems"
command: /sbin/shutdown -t now
when: ansible_os_family == "Debian"
- name: foo is not defined
fail: msg="Bailing out. this play requires 'bar'"
when: bar is not defined
Slide 19
Slide 19 text
Conditionals
- name: Check if PHP is installed
register: php_install
command: php -v
ignore_errors: true
- name: Do something if PHP is installed
debug: var=php_install
when: php_install|success
- name: Do something if PHP is NOT installed
debug: msg='PHP is NOT installed!'
when: php_install|failed
Slide 20
Slide 20 text
Conditionals
- name: Check if PHP is installed
register: php_install
command: php -v
ignore_errors: true
- name: Do something if PHP is installed
debug: var=php_install
when: php_install|success
- name: Do something if PHP is NOT installed
debug: msg='PHP is NOT installed!'
when: php_install|failed
Slide 21
Slide 21 text
Conditionals
- name: Check if PHP is installed
register: php_install
command: php -v
ignore_errors: true
- name: Do something if PHP is installed
debug: var=php_install
when: php_install|success
- name: Do something if PHP is NOT installed
debug: msg='PHP is NOT installed!'
when: php_install|failed