Submit Search
Upload
Deploying PHP Applications with Ansible
•
5 likes
•
6,157 views
Orestes Carracedo
Follow
A quick introduction to Ansible and how to deploy simple PHP applications.
Read less
Read more
Technology
Report
Share
Report
Share
1 of 34
Download now
Download to read offline
Recommended
Why Configuration Management Matters
Why Configuration Management Matters
ManageEngine, Zoho Corporation
Rapport Kernel Linux - Configuration – Compilation & installation
Rapport Kernel Linux - Configuration – Compilation & installation
Ayoub Rouzi
memoire utilisation de Puppet et Nagios
memoire utilisation de Puppet et Nagios
abouaalexis
package mangement
package mangement
ARYA TM
Ftp server
Ftp server
pawnbeeta
Linux file system
Linux file system
Midaga Mengistu
Linux basic commands
Linux basic commands
Sagar Kumar
MeetBSD2014 Performance Analysis
MeetBSD2014 Performance Analysis
Brendan Gregg
Recommended
Why Configuration Management Matters
Why Configuration Management Matters
ManageEngine, Zoho Corporation
Rapport Kernel Linux - Configuration – Compilation & installation
Rapport Kernel Linux - Configuration – Compilation & installation
Ayoub Rouzi
memoire utilisation de Puppet et Nagios
memoire utilisation de Puppet et Nagios
abouaalexis
package mangement
package mangement
ARYA TM
Ftp server
Ftp server
pawnbeeta
Linux file system
Linux file system
Midaga Mengistu
Linux basic commands
Linux basic commands
Sagar Kumar
MeetBSD2014 Performance Analysis
MeetBSD2014 Performance Analysis
Brendan Gregg
Linux Ethernet device driver
Linux Ethernet device driver
艾鍗科技
User Administration in Linux
User Administration in Linux
SAMUEL OJO
Linux System Monitoring
Linux System Monitoring
PriyaTeli
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
Eueung Mulyana
Linux Troubleshooting
Linux Troubleshooting
Keith Wright
The linux file system structure
The linux file system structure
Teja Bheemanapally
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
Cours linux complet
Cours linux complet
aubin82
Memory management in Linux
Memory management in Linux
Raghu Udiyar
Proxmox for DevOps
Proxmox for DevOps
Jorge Moratilla Porras
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
Kernel TLV
現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧
Chu-Siang Lai
Introduction to Linux
Introduction to Linux
sureskal
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
cyberleon95
Basic Linux Internals
Basic Linux Internals
mukul bhardwaj
IBM Configuration Assistant for z/OS Communications Server update
IBM Configuration Assistant for z/OS Communications Server update
zOSCommserver
Relax and Recover on POWER (Updated 05-2017)
Relax and Recover on POWER (Updated 05-2017)
Sebastien Chabrolles
Linux cheat-sheet
Linux cheat-sheet
Craig Cannon
Root file system for embedded systems
Root file system for embedded systems
alok pal
Kvm and libvirt
Kvm and libvirt
plarsen67
Automation and Ansible
Automation and Ansible
jtyr
Automated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
More Related Content
What's hot
Linux Ethernet device driver
Linux Ethernet device driver
艾鍗科技
User Administration in Linux
User Administration in Linux
SAMUEL OJO
Linux System Monitoring
Linux System Monitoring
PriyaTeli
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
Eueung Mulyana
Linux Troubleshooting
Linux Troubleshooting
Keith Wright
The linux file system structure
The linux file system structure
Teja Bheemanapally
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
Cours linux complet
Cours linux complet
aubin82
Memory management in Linux
Memory management in Linux
Raghu Udiyar
Proxmox for DevOps
Proxmox for DevOps
Jorge Moratilla Porras
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
Kernel TLV
現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧
Chu-Siang Lai
Introduction to Linux
Introduction to Linux
sureskal
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
cyberleon95
Basic Linux Internals
Basic Linux Internals
mukul bhardwaj
IBM Configuration Assistant for z/OS Communications Server update
IBM Configuration Assistant for z/OS Communications Server update
zOSCommserver
Relax and Recover on POWER (Updated 05-2017)
Relax and Recover on POWER (Updated 05-2017)
Sebastien Chabrolles
Linux cheat-sheet
Linux cheat-sheet
Craig Cannon
Root file system for embedded systems
Root file system for embedded systems
alok pal
Kvm and libvirt
Kvm and libvirt
plarsen67
What's hot
(20)
Linux Ethernet device driver
Linux Ethernet device driver
User Administration in Linux
User Administration in Linux
Linux System Monitoring
Linux System Monitoring
ONOS SDN Controller - Clustering Tests & Experiments
ONOS SDN Controller - Clustering Tests & Experiments
Linux Troubleshooting
Linux Troubleshooting
The linux file system structure
The linux file system structure
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
Cours linux complet
Cours linux complet
Memory management in Linux
Memory management in Linux
Proxmox for DevOps
Proxmox for DevOps
Building Network Functions with eBPF & BCC
Building Network Functions with eBPF & BCC
現代 IT 人一定要知道的 Ansible 自動化組態技巧
現代 IT 人一定要知道的 Ansible 自動化組態技巧
Introduction to Linux
Introduction to Linux
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
Instalación y Configuración de Exchange 2013 en Windows Server 2012 R2
Basic Linux Internals
Basic Linux Internals
IBM Configuration Assistant for z/OS Communications Server update
IBM Configuration Assistant for z/OS Communications Server update
Relax and Recover on POWER (Updated 05-2017)
Relax and Recover on POWER (Updated 05-2017)
Linux cheat-sheet
Linux cheat-sheet
Root file system for embedded systems
Root file system for embedded systems
Kvm and libvirt
Kvm and libvirt
Viewers also liked
Automation and Ansible
Automation and Ansible
jtyr
Automated Deployments with Ansible
Automated Deployments with Ansible
Martin Etmajer
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Robert Reiz
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Sarah Z
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Idan Tohami
Ansible presentation
Ansible presentation
John Lynch
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
Dennis Rowe
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Martin Etmajer
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
Brian Schott
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansible
fmaccioni
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
bcoca
Ansible tips & tricks
Ansible tips & tricks
bcoca
Ansible Introduction
Ansible Introduction
Robert Reiz
How Ansible Makes Automation Easy
How Ansible Makes Automation Easy
Peter Sankauskas
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
Carlos Perez
Vagrant For DevOps
Vagrant For DevOps
Lalatendu Mohanty
Vagrant to-aws-flow
Vagrant to-aws-flow
Kimberly Macias
Microservices: The Right Way
Microservices: The Right Way
Daniel Woods
Automated Deployment with Capistrano
Automated Deployment with Capistrano
Sumit Chhetri
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
Chef Software, Inc.
Viewers also liked
(20)
Automation and Ansible
Automation and Ansible
Automated Deployments with Ansible
Automated Deployments with Ansible
Infrastructure Deployment with Docker & Ansible
Infrastructure Deployment with Docker & Ansible
Ansible: How to Get More Sleep and Require Less Coffee
Ansible: How to Get More Sleep and Require Less Coffee
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible 2.0 - How to use Ansible to automate your applications in AWS.
Ansible presentation
Ansible presentation
Testing Ansible with Jenkins and Docker
Testing Ansible with Jenkins and Docker
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Test-Driven Infrastructure with Ansible, Test Kitchen, Serverspec and RSpec
Using Ansible Dynamic Inventory with Amazon EC2
Using Ansible Dynamic Inventory with Amazon EC2
Managing Your Cisco Datacenter Network with Ansible
Managing Your Cisco Datacenter Network with Ansible
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
Ansible tips & tricks
Ansible tips & tricks
Ansible Introduction
Ansible Introduction
How Ansible Makes Automation Easy
How Ansible Makes Automation Easy
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
Vagrant For DevOps
Vagrant For DevOps
Vagrant to-aws-flow
Vagrant to-aws-flow
Microservices: The Right Way
Microservices: The Right Way
Automated Deployment with Capistrano
Automated Deployment with Capistrano
Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
Similar to Deploying PHP Applications with Ansible
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Simon Boulet
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stack
Dana Luther
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHP
hernanibf
Lean Php Presentation
Lean Php Presentation
Alan Pinstein
How to install and configure LEMP stack
How to install and configure LEMP stack
RootGate
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Stein Inge Morisbak
PHP selber bauen
PHP selber bauen
Walter Ebert
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
Outlyer
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
mapserver_install_linux
mapserver_install_linux
tutorialsruby
mapserver_install_linux
mapserver_install_linux
tutorialsruby
mapserver_install_linux
mapserver_install_linux
tutorialsruby
mapserver_install_linux
mapserver_install_linux
tutorialsruby
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
Puppet
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
Salesforce Developers
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Raja Rozali Raja Hasan
Deployment with capifony
Deployment with capifony
Jan De Coster
DevOps in PHP environment
DevOps in PHP environment
Evaldo Felipe
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
Fabio Kung
Similar to Deploying PHP Applications with Ansible
(20)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Deploying with Super Cow Powers (Hosting your own APT repository with reprepro)
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stack
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHP
Lean Php Presentation
Lean Php Presentation
How to install and configure LEMP stack
How to install and configure LEMP stack
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
PHP selber bauen
PHP selber bauen
Minimum Viable Docker: our journey towards orchestration
Minimum Viable Docker: our journey towards orchestration
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
mapserver_install_linux
Writing & Sharing Great Modules - Puppet Camp Boston
Writing & Sharing Great Modules - Puppet Camp Boston
PHP on Heroku: Deploying and Scaling Apps in the Cloud
PHP on Heroku: Deploying and Scaling Apps in the Cloud
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Installing php 7.4 Nginx Laravel 7.x on Centos 8
Deployment with capifony
Deployment with capifony
DevOps in PHP environment
DevOps in PHP environment
Ruby and Rails Packaging to Production
Ruby and Rails Packaging to Production
More from Orestes Carracedo
Receipt processing with Google Cloud Platform and the Google Assistant
Receipt processing with Google Cloud Platform and the Google Assistant
Orestes Carracedo
Stand out from the herd
Stand out from the herd
Orestes Carracedo
Ansible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User Group
Orestes Carracedo
Android push notifications
Android push notifications
Orestes Carracedo
Betabeers Android as a Digital Signage platform
Betabeers Android as a Digital Signage platform
Orestes Carracedo
Android as a digital signage platform
Android as a digital signage platform
Orestes Carracedo
More from Orestes Carracedo
(6)
Receipt processing with Google Cloud Platform and the Google Assistant
Receipt processing with Google Cloud Platform and the Google Assistant
Stand out from the herd
Stand out from the herd
Ansible Intro - June 2015 / Ansible Barcelona User Group
Ansible Intro - June 2015 / Ansible Barcelona User Group
Android push notifications
Android push notifications
Betabeers Android as a Digital Signage platform
Betabeers Android as a Digital Signage platform
Android as a digital signage platform
Android as a digital signage platform
Recently uploaded
Evaluating the top large language models.pdf
Evaluating the top large language models.pdf
ChristopherTHyatt
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
Antenna Manufacturer Coco
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
naman860154
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Recently uploaded
(20)
Evaluating the top large language models.pdf
Evaluating the top large language models.pdf
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
How to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Deploying PHP Applications with Ansible
1.
Deploying PHP applications with CC https://www.flickr.com/photos/din_bcn/2551132104/ @OrestesCA
@phpvigo
2.
Orestes Carracedo Software Consultant @OrestesCA whoami ßetabeers Barcelona @OrestesCA @phpvigo
3.
@OrestesCA @phpvigo 2003 2015
4.
1. Deployment 2. Ansible 3.
All together @OrestesCA @phpvigo
5.
Deployment @OrestesCA @phpvigo
6.
Blue-green deployment @OrestesCA @phpvigo http://martinfowler.com/bliki/BlueGreenDeployment.html
7.
Simple blue-green deployment @OrestesCA
@phpvigo -- /var/www/my-app.com |-- current -> /var/www/my-app.com/releases/20100509150741 |-- releases | |-- 20100509150741 | |-- 20100509145325 |-- shared
8.
Blue-green deployment: demo @OrestesCA
@phpvigo
9.
Ansible 1. Setup 2. Inventory 3.
Commands 4. Modules 5. Tasks 6. Roles @OrestesCA @phpvigo
10.
What is Ansible SCM
automation tool agent-less simple + powerful @OrestesCA @phpvigo
11.
Connections Managed Node #1 Managed
Node #2 Control Machine Inventory ssh @OrestesCA @phpvigo
12.
Control Machine setup http://docs.ansible.com $
sudo pip install ansible … $ ansible ansible ansible-doc ansible-galaxy ansible- playbook ansible-pull ansible-vault @OrestesCA @phpvigo
13.
Inventory setup $ export
ANSIBLE_INVENTORY=~/ansible_hosts [vagrant] 127.0.0.1:2222 foo=bar [vagrant:vars] ansible_ssh_user=vagrant env=local http://docs.ansible.com/intro_inventory.html https://docs.ansible.com/playbooks_variables.html Precedence: -i file or $ANSIBLE_INVENTORY or /etc/ansible/hosts @OrestesCA @phpvigo
14.
Modules $ ansible vagrant
-m ping --vvvv <127.0.0.1> ESTABLISH CONNECTION FOR USER: vagrant on PORT 2222 TO 127.0.0.1 <127.0.0.1> REMOTE_MODULE ping … 127.0.0.1 | success >> { "changed": false, "ping": "pong" } $ ansible all -m ping —vvvv … @OrestesCA @phpvigo
15.
Random fact _________________ < GATHERING
FACTS > ----------------- ^__^ (oo)_______ (__) )/ ||----w | || || http://docs.ansible.com/faq.html#how-do-i-disable-cowsay export ANSIBLE_NOCOWS=1 @OrestesCA @phpvigo
16.
Playbooks - hosts: vagrant sudo:
True tasks: - name: Install ntp apt: pkg=ntp state=installed $ ansible-playbook test_playbook.yml … GATHERING FACTS ok: [127.0.0.1] TASK: [Install ntp] changed: [127.0.0.1] PLAY RECAP 127.0.0.1: ok=2 changed=1 unreachable=0 failed=0 test_playbook.yml @OrestesCA @phpvigo
17.
Idempotence - hosts: vagrant sudo:
True tasks: - name: Install ntp apt: pkg=ntp state=installed $ ansible-playbook test_playbook.yml … GATHERING FACTS ok: [127.0.0.1] TASK: [Install ntp] ok: [127.0.0.1] PLAY RECAP 127.0.0.1: ok=2 changed=0 unreachable=0 failed=0 test_playbook.yml @OrestesCA @phpvigo
18.
Idempotence - hosts: vagrant sudo:
True tasks: - name: Install ntp apt: pkg=ntp state=installed $ ansible-playbook test_playbook.yml … GATHERING FACTS ok: [127.0.0.1] TASK: [Install ntp] ok: [127.0.0.1] PLAY RECAP 127.0.0.1: ok=2 changed=0 unreachable=0 failed=0 test_playbook.yml @OrestesCA @phpvigo
19.
Facts $ ansible vagrant
-m setup 127.0.0.1 | success >> { "ansible_facts": { "ansible_all_ipv4_addresses": [ "10.0.2.15" ], "ansible_all_ipv6_addresses": [ "fe80::a00:27ff:fe6b:d3e" ], "ansible_architecture": "x86_64", "ansible_bios_date": "12/01/2006", "ansible_bios_version": "VirtualBox", … @OrestesCA @phpvigo
20.
Templates, facts and
variables - hosts: vagrant sudo: True tasks: - name: Write MOTD template: src=templates/motd dest=/etc/motd You’re now in the {{ env | upper }} environment at {{ ansible_hostname }} {{ ansible_distribution }} {{ansible_distribution_release }} {{ ansible_distribution_version }} {{ ansible_system }} {{ ansible_kernel }} {{ ansible_architecture }} test_playbook.yml templates/motd You’re now in the LOCAL environment at Debian-jessie-amd64- netboot Debian jessie 8.0 Linux 3.16.0-4-amd64 x86_64 @OrestesCA @phpvigo
21.
Conditionals - name: Enable
LOCAL env prompt indicator template: src=templates/env/local/.bash_profile dest=~/.bash_profile when: env == "local" test_playbook.yml export PS1="[$(tput setaf 2)][u@h W]$ [$(tput setaf 7)][$(tput sgr0)]" templates/.bash_profile [vagrant@Debian-jessie-amd64-netboot ~]$ https://docs.ansible.com/playbooks_conditionals.html @OrestesCA @phpvigo
22.
Notifications and handlers -
hosts: webservers vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running (and enable it at boot) service: name=httpd state=started enabled=yes handlers: - name: restart apache service: name=httpd state=restarted @OrestesCA @phpvigo
23.
Roles site.yml roles/ common/ files/ templates/ tasks/ handlers/ vars/ defaults/ meta/ webserver/ … files https://docs.ansible.com/playbooks_roles.html https://github.com/ansible/ansible-examples - hosts: webservers roles: -
common - webserver site.yml @OrestesCA @phpvigo
24.
First steps in
practice Dependencies Credentials Deployment @OrestesCA @phpvigo
25.
Install dependencies $ ansible-playbook
test_playbook.yml … /bin/sh: 1: /usr/bin/python: not found … Missing Python gather_facts: False tasks: - name: Install Python raw: apt-get install python -y - name: Gather facts after python install setup: - name: Write MOTD … test_playbook.yml @OrestesCA @phpvigo
26.
Install dependencies $ ansible-playbook
test_playbook.yml --sudo PLAY [vagrant] TASK: [Install Python] ok: [127.0.0.1] TASK: [Gather facts] ok: [127.0.0.1] TASK: [Write MOTD] changed: [127.0.0.1] PLAY RECAP 127.0.0.1: ok=3 changed=1 unreachable=0 failed=0 test_playbook.yml @OrestesCA @phpvigo
27.
Setup remote access -
name: Setup access authorized_key: user="{{ ansible_ssh_user }}" key="{{ item }}" with_file: - ~/.ssh/id_rsa.pub - /some/secure/dir/keys/admin.pub test_playbook.yml http://docs.ansible.com/authorized_key_module.html $ ansible-playbook test_playbook.yml --ask-pass SSH password: TASK: [Setup access] ok: [127.0.0.1] => (item=ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD… orestes@mjolnir.local) … @OrestesCA @phpvigo
28.
Simple deployment - name:
Clone git repository git: > dest=/var/www/awesome-app repo=https://github.com/initech/awesome-app update=no sudo: yes sudo_user: www-data register: cloned - name: Clear cache … when: cloned|changed test_playbook.yml https://github.com/ansistrano http://www.future500.nl/articles/2014/07/thoughts-on-deploying-with-ansible/ @OrestesCA @phpvigo
29.
Advanced deployment http://www.ansible.com/application-deployment http://docs.ansible.com/playbooks_delegation.html - hosts:
webservers max_fail_percentage: 30 serial: 10 @OrestesCA @phpvigo
30.
Learning from the
community https://galaxy.ansible.com @OrestesCA @phpvigo
31.
All together @OrestesCA @phpvigo
32.
Using a contributed
role @OrestesCA @phpvigo - name: Deploy my-app.com hosts: production vars: ansistrano_allow_anonymous_stats: no ansistrano_deploy_to: /var/www/my-app.com ansistrano_keep_releases: 10 ansistrano_deploy_via: git ansistrano_git_repo: git@bitbucket.org:orestes/my-app.com.git ansistrano_git_branch: build roles: - { role: carlosbuenosvinos.ansistrano-deploy } $ ansible-galaxy install carlosbuenosvinos.ansistrano-deploy https://github.com/ansistrano/deploy
33.
final demo @OrestesCA @phpvigo
34.
EOF ___________________ < THAT’S ALL
FOLKS! > ------------------- ^__^ (oo)_______ (__) )/ ||----w | || || @OrestesCA @phpvigo
Download now