SlideShare une entreprise Scribd logo
1  sur  51
Télécharger pour lire hors ligne
ANSIBLE-PROJECT-DEPLOY
a re-usable Ansible role to deploy projects
ABOUT US
2
Ramon de la Fuente	

@f_u_e_n_t_e
Jasper N. Brouwer	

@jaspernbrouwer
ABOUT US
3
Ramon de la Fuente	

@f_u_e_n_t_e
Jasper N. Brouwer	

@jaspernbrouwer
Future500 B.V.
WHY ANSIBLE?
• Easy. Period.
4
“I wrote Ansible because none of the existing tools fit my brain.” 	

!
- Michael de Haan
WHY ANSIBLE?
• Easy. Period.	

• No unnecessary complexity → No agent!
5
WHY ANSIBLE?
• Easy. Period.	

• No unnecessary complexity → No agent!	

• Built for re-use and sharing.
6
WHY ANSIBLE?
• Easy. Period.	

• No unnecessary complexity → No agent!	

• Built for re-use and sharing.	

• Extendable in your own language.
7
THE PROBLEM
• Continuous deployment
8
THE PROBLEM
• Continuous deployment	

• Easy maintenance of the deploy procedure.
9
THE PROBLEM
• Continuous deployment	

• Easy maintenance of the deploy procedure.	

• Small learning curve.
10
THE PROBLEM
• Continuous deployment	

• Easy maintenance of the deploy procedure.	

• Small learning curve.	

• Reuse between projects with little effort.
11
WHAT IS A DEPLOY?
Directory structure:
.
!"" releases
| !"" 20140415234508
| #"" 20140415235146
!"" shared
| !"" sessions
| !"" source
| #"" uploads
#"" current -> releases/20140415235146
12
WHAT IS A DEPLOY?
Directory structure:
.
!"" releases
| !"" 20140415234508
| #"" 20140415235146
!"" shared
| !"" sessions
| !"" source
| #"" uploads
#"" current -> releases/20140415235146
13
WHAT IS A DEPLOY?
1. Update the codebase + configuration
14
WHAT IS A DEPLOY?
1. Update the codebase + configuration	

2. Install dependencies
15
WHAT IS A DEPLOY?
1. Update the codebase + configuration	

2. Install dependencies	

3. Preserve shared resources
16
WHAT IS A DEPLOY?
1. Update the codebase + configuration	

2. Install dependencies	

3. Preserve shared resources	

4. Build tasks
17
WHAT IS A DEPLOY?
1. Update the codebase + configuration	

2. Install dependencies	

3. Preserve shared resources	

4. Build tasks	

5. Finalize
18
THE ROLE
19
https://galaxy.ansible.com/list#/roles/732
project_deploy
GETTINGTHE ROLE
Installation with ansible-galaxy command:
!
$ ansible-galaxy install f500.project_deploy,v1.0.0
Optional: create a galaxy file for all roles:
!
f500.nginx
f500.mariadb55
f500.php
f500.project_deploy,v1.0.0
!
$ ansible-galaxy install -r ansible/galaxy.txt
20
ROLE WALKTHROUGH
!
---
!
- name: Initialize
deploy: "path={{ project_root }} state=present"
21
ROLE WALKTHROUGH
!
Deploy module variables:
!
deploy:
project_path
current_path
releases_path
shared_path
last_release
last_release_path
new_release
new_release_path
unfinished_filename
!
!
22
ROLE WALKTHROUGH
!
Deploy module variables:
!
deploy:
project_path: /path/to/project/
current_path: /path/to/project/current
releases_path: /path/to/project/releases
shared_path: /path/to/project/shared
last_release: 20140415234508
last_release_path: /path/to/project/releases/20140415234508
new_release: 20140415235146
new_release_path: /path/to/project/releases/20140415235146
unfinished_filename: DEPLOY_UNFINISHED
Used as:
{{ deploy.new_release }}
23
1. UPDATETHE CODEBASE
!
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
!
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
!
24
1. UPDATETHE CODEBASE
!
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
!
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
!
25
1. UPDATETHE CODEBASE
!
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
!
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
!
26
1. UPDATETHE CODEBASE
!
- name: Write unfinished file
file: path={{ project_source_path }}/{{ deploy.unfinished_filename }}
state=touch
!
- name: Copy files to new build dir
command: "cp -pr {{ project_source_path }} {{ deploy.new_release_path }}"
!
- name: Remove unwanted files/folders from new release
file: path={{ deploy.new_release_path }}/{{ item }} state=absent
with_items: project_unwanted_items
27
1. UPDATETHE CONFIG FILES
!
- name: Copy project files
copy: src={{ item.src }}
dest={{ deploy.new_release_path }}/{{ item.dest }}
mode={{ item.mode|default('0644') }}
with_items: project_files
!
- name: Copy project templates
template: src={{ item.src }}
dest={{ deploy.new_release_path }}/{{ item.dest }}
mode={{ item.mode|default('0644') }}
with_items: project_templates
28
2. INSTALL DEPENDENCIES
!
- name: Do composer install
command: "{{ project_command_for_composer_install }} chdir=…"
environment: project_environment
when: project_has_composer
!
- name: Do npm install
command: "{{ project_command_for_npm_install }} chdir=…"
environment: project_environment
when: project_has_npm
!
- name: Do bower install
command: "{{ project_command_for_bower_install }} chdir=…"
environment: project_environment
when: project_has_bower
29
2. INSTALL DEPENDENCIES
!
- name: Do composer install
command: "{{ project_command_for_composer_install }} chdir=…"
environment: project_environment
when: project_has_composer
!
- name: Do npm install
command: "{{ project_command_for_npm_install }} chdir=…"
environment: project_environment
when: project_has_npm
!
- name: Do bower install
command: "{{ project_command_for_bower_install }} chdir=…"
environment: project_environment
when: project_has_bower
30
3. SHARED RESOURCES
!
- name: Ensure shared sources are present
file: "path='{{ deploy.shared_path }}/{{ item.src }}' state={{ item.type }}“
with_items: project_shared_children
!
- name: Ensure shared paths are absent
file: "path='{{ deploy.new_release_path }}/{{ item.path }}' state=absent"
with_items: project_shared_children
!
- name: Create shared symlinks
file: path='{{ deploy.new_release_path }}/{{ item.path }}'
src='{{ deploy.shared_path }}/{{ item.src }}'
state=link"
with_items: project_shared_children
31
4. BUILD STEPS
!
- name: Run post_build_commands in the new_release_path
command: "{{ item }} chdir={{ deploy.new_release_path }}"
with_items: project_post_build_commands
environment: project_environment
32
!
project_post_build_commands:
- "app/console cache:clear"
- "app/console assets:install"
- "app/console assetic:dump"
5. FINALIZE
!
- name: Remove unfinished file
file: path={{ deploy.new_release_path }}/{{ deploy.unfinished_filename }}
state=absent
when: project_finalize
!
- name: Finalize the deploy
file: src={{ deploy.new_release_path }} dest={{ deploy.current_path }}
state=link
when: project_finalize
33
34
IT’S NOT COMPLICATED!
• Only 75 lines	

• Number of tasks: 18	

• Variables to configure: 24
35
EXAMPLE PLAYBOOK
1. Set minimum variables	

2. Add the role to “roles” section
36
MINIMAL PLAYBOOK
!
- name: Deploy the application
hosts: production
remote_user: deploy
sudo: no
!
vars:
project_root: /var/www/my_project
project_git_repo: git@github.com:me/my_project.git
project_deploy_strategy: git
!
roles:
- f500.project_deploy
37
EXAMPLE PLAYBOOK
!
- name: Deploy the application
hosts: production
remote_user: "{{ production_deploy_user }}"
sudo: no
!
vars:
project_root: "{{ sweetlakephp_root }}"
project_git_repo: "{{ sweetlakephp_github_repo }}"
project_deploy_strategy: git
38
EXAMPLE PLAYBOOK
!
- name: Deploy the application
hosts: production
remote_user: "{{ production_deploy_user }}"
sudo: no
!
vars:
project_root: "{{ sweetlakephp_root }}"
project_git_repo: "{{ sweetlakephp_github_repo }}"
project_deploy_strategy: git
!
project_environment:
SYMFONY_ENV: "prod"
39
EXAMPLE PLAYBOOK
!
project_environment:
SYMFONY_ENV: "prod"
!
project_shared_children:
- path: "/app/sessions"
src: "sessions"
- path: "/web/uploads"
src: "uploads"
!
project_templates:
- name: parameters.yml
src: "templates/parameters_prod.yml.j2"
dest: "/app/config/parameters_prod.yml"
!
40
EXAMPLE PLAYBOOK
!
project_environment:
SYMFONY_ENV: "prod"
!
project_shared_children:
- path: "/app/sessions"
src: "sessions"
- path: "/web/uploads"
src: "uploads"
!
project_templates:
- name: parameters.yml
src: "templates/parameters_prod.yml.j2"
dest: "/app/config/parameters_prod.yml"
!
41
EXAMPLE PLAYBOOK
!
project_has_composer: yes
!
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
!
roles:
- f500.project_deploy
!
post_tasks:
- name: Remove old releases
deploy: "path={{ project_root }} state=clean"
42
EXAMPLE PLAYBOOK
!
project_has_composer: yes
!
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
!
roles:
- f500.project_deploy
!
post_tasks:
- name: Remove old releases
deploy: "path={{ project_root }} state=clean"
43
EXAMPLE PLAYBOOK
44
!
project_has_composer: yes
!
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
!
roles:
- f500.project_deploy
!
post_tasks:
- name: Remove old releases
deploy: "path={{ project_root }} state=clean"
WHAT DOESN’T IT DO?
45
• Rollbacks (the cake rollback is a lie)
WHAT DOESN’T IT DO?
46
• Rollbacks	

• Set maintenance mode
(the cake rollback is a lie)
WHAT DOESN’T IT DO?
47
• Rollbacks	

• Set maintenance mode	

• DB migrations
(the cake rollback is a lie)
WHAT’S NEXT?
48
• Full-blown Actions in addition to commands
WHAT’S NEXT?
49
• Full-blown Actions in addition to commands	

• Setfacl support
WHAT’S NEXT?
50
• Full-blown Actions in addition to commands	

• Setfacl support	

• Your ideas?
THANKYOU!
51
Feedback: joind.in?
https://github.com/f500/ansible-project_deploy
(But we’re also people. You could just talk to us and tell us what you think…)

Contenu connexe

Tendances

[Public] gerrit concepts and workflows
[Public] gerrit   concepts and workflows[Public] gerrit   concepts and workflows
[Public] gerrit concepts and workflowsYanbin Kong
 
A Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptA Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptjonathanfmills
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiJian-Hong Pan
 
도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편Sam Kim
 
Why Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your ShellWhy Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your Shelljaguardesignstudio
 
Hyundai sonata nf 2005 2013 engine electrical system
Hyundai sonata nf 2005 2013 engine electrical systemHyundai sonata nf 2005 2013 engine electrical system
Hyundai sonata nf 2005 2013 engine electrical systemtrang đỗ
 
Rust Is Safe. But Is It Fast?
Rust Is Safe. But Is It Fast?Rust Is Safe. But Is It Fast?
Rust Is Safe. But Is It Fast?ScyllaDB
 
Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformSZ Lin
 
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...Preventing Linux in your car from killing you: The L4Re Open Source Microviso...
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...Linaro
 
essen-und-trinken-arbeitsblatter_91156.ppt
essen-und-trinken-arbeitsblatter_91156.pptessen-und-trinken-arbeitsblatter_91156.ppt
essen-und-trinken-arbeitsblatter_91156.pptssuser8112ba1
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsRajith Bhanuka Mahanama
 
Simple.present.gram.level1.u5.
Simple.present.gram.level1.u5.Simple.present.gram.level1.u5.
Simple.present.gram.level1.u5.garcia58
 
One-Liners to Rule Them All
One-Liners to Rule Them AllOne-Liners to Rule Them All
One-Liners to Rule Them Allegypt
 

Tendances (17)

[Public] gerrit concepts and workflows
[Public] gerrit   concepts and workflows[Public] gerrit   concepts and workflows
[Public] gerrit concepts and workflows
 
Git 101
Git 101Git 101
Git 101
 
A Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptA Skeptics guide to functional style javascript
A Skeptics guide to functional style javascript
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry Pi
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
Git
GitGit
Git
 
tmux
tmuxtmux
tmux
 
도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편도커 없이 컨테이너 만들기 3편
도커 없이 컨테이너 만들기 3편
 
Why Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your ShellWhy Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your Shell
 
Hyundai sonata nf 2005 2013 engine electrical system
Hyundai sonata nf 2005 2013 engine electrical systemHyundai sonata nf 2005 2013 engine electrical system
Hyundai sonata nf 2005 2013 engine electrical system
 
Rust Is Safe. But Is It Fast?
Rust Is Safe. But Is It Fast?Rust Is Safe. But Is It Fast?
Rust Is Safe. But Is It Fast?
 
Embedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 PlatformEmbedded Linux/ Debian with ARM64 Platform
Embedded Linux/ Debian with ARM64 Platform
 
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...Preventing Linux in your car from killing you: The L4Re Open Source Microviso...
Preventing Linux in your car from killing you: The L4Re Open Source Microviso...
 
essen-und-trinken-arbeitsblatter_91156.ppt
essen-und-trinken-arbeitsblatter_91156.pptessen-und-trinken-arbeitsblatter_91156.ppt
essen-und-trinken-arbeitsblatter_91156.ppt
 
Default GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOpsDefault GitLab CI Pipeline - Auto DevOps
Default GitLab CI Pipeline - Auto DevOps
 
Simple.present.gram.level1.u5.
Simple.present.gram.level1.u5.Simple.present.gram.level1.u5.
Simple.present.gram.level1.u5.
 
One-Liners to Rule Them All
One-Liners to Rule Them AllOne-Liners to Rule Them All
One-Liners to Rule Them All
 

En vedette

ข้อสอบ ม ช ชุดที่ 1
ข้อสอบ ม ช ชุดที่ 1ข้อสอบ ม ช ชุดที่ 1
ข้อสอบ ม ช ชุดที่ 1is_saraporn
 
Pendidikan kewarganegaraan 5 ra - 7 apr2014
Pendidikan kewarganegaraan 5   ra - 7 apr2014Pendidikan kewarganegaraan 5   ra - 7 apr2014
Pendidikan kewarganegaraan 5 ra - 7 apr2014Muhammad Muzakky
 
Narradores de Javé Histórias de Minas
Narradores de Javé   Histórias de MinasNarradores de Javé   Histórias de Minas
Narradores de Javé Histórias de MinasAdélia Nicolete
 
Broadening teaching perspective
Broadening teaching perspectiveBroadening teaching perspective
Broadening teaching perspectivedanchariza
 
Permen kes 1144_menkesperviii2010_2010
Permen kes 1144_menkesperviii2010_2010Permen kes 1144_menkesperviii2010_2010
Permen kes 1144_menkesperviii2010_2010Suratman Garahama
 
The Architecture and Engineering Labor Market: Worldwide and China
The Architecture and Engineering Labor Market: Worldwide and ChinaThe Architecture and Engineering Labor Market: Worldwide and China
The Architecture and Engineering Labor Market: Worldwide and ChinaIntuuChina
 
سال بلوا
سال بلواسال بلوا
سال بلواqoqnoos
 
Is Your Relationship #1?
Is Your Relationship #1?Is Your Relationship #1?
Is Your Relationship #1?MichelleGFans
 

En vedette (13)

ข้อสอบ ม ช ชุดที่ 1
ข้อสอบ ม ช ชุดที่ 1ข้อสอบ ม ช ชุดที่ 1
ข้อสอบ ม ช ชุดที่ 1
 
Pp 101 tahun_2000
Pp 101 tahun_2000Pp 101 tahun_2000
Pp 101 tahun_2000
 
Andrew's solution
Andrew's solutionAndrew's solution
Andrew's solution
 
Pendidikan kewarganegaraan 5 ra - 7 apr2014
Pendidikan kewarganegaraan 5   ra - 7 apr2014Pendidikan kewarganegaraan 5   ra - 7 apr2014
Pendidikan kewarganegaraan 5 ra - 7 apr2014
 
Narradores de Javé Histórias de Minas
Narradores de Javé   Histórias de MinasNarradores de Javé   Histórias de Minas
Narradores de Javé Histórias de Minas
 
Broadening teaching perspective
Broadening teaching perspectiveBroadening teaching perspective
Broadening teaching perspective
 
Permen kes 1144_menkesperviii2010_2010
Permen kes 1144_menkesperviii2010_2010Permen kes 1144_menkesperviii2010_2010
Permen kes 1144_menkesperviii2010_2010
 
The Architecture and Engineering Labor Market: Worldwide and China
The Architecture and Engineering Labor Market: Worldwide and ChinaThe Architecture and Engineering Labor Market: Worldwide and China
The Architecture and Engineering Labor Market: Worldwide and China
 
سال بلوا
سال بلواسال بلوا
سال بلوا
 
Gouripur
GouripurGouripur
Gouripur
 
Provance
ProvanceProvance
Provance
 
Bashor ha
Bashor haBashor ha
Bashor ha
 
Is Your Relationship #1?
Is Your Relationship #1?Is Your Relationship #1?
Is Your Relationship #1?
 

Similaire à Ansible project-deploy

Ansible project-deploy (NomadPHP lightning talk)
Ansible project-deploy (NomadPHP lightning talk)Ansible project-deploy (NomadPHP lightning talk)
Ansible project-deploy (NomadPHP lightning talk)Ramon de la Fuente
 
Ansible Project Deploy (phpbenelux 2015)
Ansible Project Deploy (phpbenelux 2015)Ansible Project Deploy (phpbenelux 2015)
Ansible Project Deploy (phpbenelux 2015)Ramon de la Fuente
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to MavenEric Wyles
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...Docker, Inc.
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014Rafe Colton
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldDmitry Bakaleinik
 
Host any project in che with stacks & chefiles
Host any project in che with stacks & chefilesHost any project in che with stacks & chefiles
Host any project in che with stacks & chefilesFlorent BENOIT
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
 
Recent Developments With ZopeSkel
Recent Developments With ZopeSkelRecent Developments With ZopeSkel
Recent Developments With ZopeSkelcbcunc
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk GötzNETWAYS
 
Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Benjamin Bischoff
 
Gigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die tryingGigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die tryingAlex Rupérez
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make filesropsu
 
Make an Instant Website with Webhooks
Make an Instant Website with WebhooksMake an Instant Website with Webhooks
Make an Instant Website with WebhooksAnne Gentle
 
SplunkLive! Hamburg / München Advanced Session
SplunkLive! Hamburg / München Advanced SessionSplunkLive! Hamburg / München Advanced Session
SplunkLive! Hamburg / München Advanced SessionGeorg Knon
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topicGourav Varma
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesSteffen Gebert
 

Similaire à Ansible project-deploy (20)

Ansible project-deploy (NomadPHP lightning talk)
Ansible project-deploy (NomadPHP lightning talk)Ansible project-deploy (NomadPHP lightning talk)
Ansible project-deploy (NomadPHP lightning talk)
 
Ansible Project Deploy (phpbenelux 2015)
Ansible Project Deploy (phpbenelux 2015)Ansible Project Deploy (phpbenelux 2015)
Ansible Project Deploy (phpbenelux 2015)
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
Host any project in che with stacks & chefiles
Host any project in che with stacks & chefilesHost any project in che with stacks & chefiles
Host any project in che with stacks & chefiles
 
Maven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable ResultsMaven: Managing Software Projects for Repeatable Results
Maven: Managing Software Projects for Repeatable Results
 
SVN essentials
SVN essentialsSVN essentials
SVN essentials
 
Recent Developments With ZopeSkel
Recent Developments With ZopeSkelRecent Developments With ZopeSkel
Recent Developments With ZopeSkel
 
Puppet getting started by Dirk Götz
Puppet getting started by Dirk GötzPuppet getting started by Dirk Götz
Puppet getting started by Dirk Götz
 
Simplifying your test runs with „Make“
Simplifying your test runs with „Make“Simplifying your test runs with „Make“
Simplifying your test runs with „Make“
 
01 spring-intro
01 spring-intro01 spring-intro
01 spring-intro
 
Gigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die tryingGigigo Workshop - Create an iOS Framework, document it and not die trying
Gigigo Workshop - Create an iOS Framework, document it and not die trying
 
Composer JSON kills make files
Composer JSON kills make filesComposer JSON kills make files
Composer JSON kills make files
 
Make an Instant Website with Webhooks
Make an Instant Website with WebhooksMake an Instant Website with Webhooks
Make an Instant Website with Webhooks
 
SplunkLive! Hamburg / München Advanced Session
SplunkLive! Hamburg / München Advanced SessionSplunkLive! Hamburg / München Advanced Session
SplunkLive! Hamburg / München Advanced Session
 
Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Jenkins advance topic
Jenkins advance topicJenkins advance topic
Jenkins advance topic
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
 

Dernier

Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 

Dernier (20)

Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 

Ansible project-deploy

  • 2. ABOUT US 2 Ramon de la Fuente @f_u_e_n_t_e Jasper N. Brouwer @jaspernbrouwer
  • 3. ABOUT US 3 Ramon de la Fuente @f_u_e_n_t_e Jasper N. Brouwer @jaspernbrouwer Future500 B.V.
  • 4. WHY ANSIBLE? • Easy. Period. 4 “I wrote Ansible because none of the existing tools fit my brain.” ! - Michael de Haan
  • 5. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! 5
  • 6. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! • Built for re-use and sharing. 6
  • 7. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! • Built for re-use and sharing. • Extendable in your own language. 7
  • 9. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. 9
  • 10. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. • Small learning curve. 10
  • 11. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. • Small learning curve. • Reuse between projects with little effort. 11
  • 12. WHAT IS A DEPLOY? Directory structure: . !"" releases | !"" 20140415234508 | #"" 20140415235146 !"" shared | !"" sessions | !"" source | #"" uploads #"" current -> releases/20140415235146 12
  • 13. WHAT IS A DEPLOY? Directory structure: . !"" releases | !"" 20140415234508 | #"" 20140415235146 !"" shared | !"" sessions | !"" source | #"" uploads #"" current -> releases/20140415235146 13
  • 14. WHAT IS A DEPLOY? 1. Update the codebase + configuration 14
  • 15. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 15
  • 16. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 16
  • 17. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 4. Build tasks 17
  • 18. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 4. Build tasks 5. Finalize 18
  • 20. GETTINGTHE ROLE Installation with ansible-galaxy command: ! $ ansible-galaxy install f500.project_deploy,v1.0.0 Optional: create a galaxy file for all roles: ! f500.nginx f500.mariadb55 f500.php f500.project_deploy,v1.0.0 ! $ ansible-galaxy install -r ansible/galaxy.txt 20
  • 21. ROLE WALKTHROUGH ! --- ! - name: Initialize deploy: "path={{ project_root }} state=present" 21
  • 22. ROLE WALKTHROUGH ! Deploy module variables: ! deploy: project_path current_path releases_path shared_path last_release last_release_path new_release new_release_path unfinished_filename ! ! 22
  • 23. ROLE WALKTHROUGH ! Deploy module variables: ! deploy: project_path: /path/to/project/ current_path: /path/to/project/current releases_path: /path/to/project/releases shared_path: /path/to/project/shared last_release: 20140415234508 last_release_path: /path/to/project/releases/20140415234508 new_release: 20140415235146 new_release_path: /path/to/project/releases/20140415235146 unfinished_filename: DEPLOY_UNFINISHED Used as: {{ deploy.new_release }} 23
  • 24. 1. UPDATETHE CODEBASE ! - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' ! - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' ! 24
  • 25. 1. UPDATETHE CODEBASE ! - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' ! - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' ! 25
  • 26. 1. UPDATETHE CODEBASE ! - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' ! - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' ! 26
  • 27. 1. UPDATETHE CODEBASE ! - name: Write unfinished file file: path={{ project_source_path }}/{{ deploy.unfinished_filename }} state=touch ! - name: Copy files to new build dir command: "cp -pr {{ project_source_path }} {{ deploy.new_release_path }}" ! - name: Remove unwanted files/folders from new release file: path={{ deploy.new_release_path }}/{{ item }} state=absent with_items: project_unwanted_items 27
  • 28. 1. UPDATETHE CONFIG FILES ! - name: Copy project files copy: src={{ item.src }} dest={{ deploy.new_release_path }}/{{ item.dest }} mode={{ item.mode|default('0644') }} with_items: project_files ! - name: Copy project templates template: src={{ item.src }} dest={{ deploy.new_release_path }}/{{ item.dest }} mode={{ item.mode|default('0644') }} with_items: project_templates 28
  • 29. 2. INSTALL DEPENDENCIES ! - name: Do composer install command: "{{ project_command_for_composer_install }} chdir=…" environment: project_environment when: project_has_composer ! - name: Do npm install command: "{{ project_command_for_npm_install }} chdir=…" environment: project_environment when: project_has_npm ! - name: Do bower install command: "{{ project_command_for_bower_install }} chdir=…" environment: project_environment when: project_has_bower 29
  • 30. 2. INSTALL DEPENDENCIES ! - name: Do composer install command: "{{ project_command_for_composer_install }} chdir=…" environment: project_environment when: project_has_composer ! - name: Do npm install command: "{{ project_command_for_npm_install }} chdir=…" environment: project_environment when: project_has_npm ! - name: Do bower install command: "{{ project_command_for_bower_install }} chdir=…" environment: project_environment when: project_has_bower 30
  • 31. 3. SHARED RESOURCES ! - name: Ensure shared sources are present file: "path='{{ deploy.shared_path }}/{{ item.src }}' state={{ item.type }}“ with_items: project_shared_children ! - name: Ensure shared paths are absent file: "path='{{ deploy.new_release_path }}/{{ item.path }}' state=absent" with_items: project_shared_children ! - name: Create shared symlinks file: path='{{ deploy.new_release_path }}/{{ item.path }}' src='{{ deploy.shared_path }}/{{ item.src }}' state=link" with_items: project_shared_children 31
  • 32. 4. BUILD STEPS ! - name: Run post_build_commands in the new_release_path command: "{{ item }} chdir={{ deploy.new_release_path }}" with_items: project_post_build_commands environment: project_environment 32 ! project_post_build_commands: - "app/console cache:clear" - "app/console assets:install" - "app/console assetic:dump"
  • 33. 5. FINALIZE ! - name: Remove unfinished file file: path={{ deploy.new_release_path }}/{{ deploy.unfinished_filename }} state=absent when: project_finalize ! - name: Finalize the deploy file: src={{ deploy.new_release_path }} dest={{ deploy.current_path }} state=link when: project_finalize 33
  • 34. 34
  • 35. IT’S NOT COMPLICATED! • Only 75 lines • Number of tasks: 18 • Variables to configure: 24 35
  • 36. EXAMPLE PLAYBOOK 1. Set minimum variables 2. Add the role to “roles” section 36
  • 37. MINIMAL PLAYBOOK ! - name: Deploy the application hosts: production remote_user: deploy sudo: no ! vars: project_root: /var/www/my_project project_git_repo: git@github.com:me/my_project.git project_deploy_strategy: git ! roles: - f500.project_deploy 37
  • 38. EXAMPLE PLAYBOOK ! - name: Deploy the application hosts: production remote_user: "{{ production_deploy_user }}" sudo: no ! vars: project_root: "{{ sweetlakephp_root }}" project_git_repo: "{{ sweetlakephp_github_repo }}" project_deploy_strategy: git 38
  • 39. EXAMPLE PLAYBOOK ! - name: Deploy the application hosts: production remote_user: "{{ production_deploy_user }}" sudo: no ! vars: project_root: "{{ sweetlakephp_root }}" project_git_repo: "{{ sweetlakephp_github_repo }}" project_deploy_strategy: git ! project_environment: SYMFONY_ENV: "prod" 39
  • 40. EXAMPLE PLAYBOOK ! project_environment: SYMFONY_ENV: "prod" ! project_shared_children: - path: "/app/sessions" src: "sessions" - path: "/web/uploads" src: "uploads" ! project_templates: - name: parameters.yml src: "templates/parameters_prod.yml.j2" dest: "/app/config/parameters_prod.yml" ! 40
  • 41. EXAMPLE PLAYBOOK ! project_environment: SYMFONY_ENV: "prod" ! project_shared_children: - path: "/app/sessions" src: "sessions" - path: "/web/uploads" src: "uploads" ! project_templates: - name: parameters.yml src: "templates/parameters_prod.yml.j2" dest: "/app/config/parameters_prod.yml" ! 41
  • 42. EXAMPLE PLAYBOOK ! project_has_composer: yes ! project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" ! roles: - f500.project_deploy ! post_tasks: - name: Remove old releases deploy: "path={{ project_root }} state=clean" 42
  • 43. EXAMPLE PLAYBOOK ! project_has_composer: yes ! project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" ! roles: - f500.project_deploy ! post_tasks: - name: Remove old releases deploy: "path={{ project_root }} state=clean" 43
  • 44. EXAMPLE PLAYBOOK 44 ! project_has_composer: yes ! project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" ! roles: - f500.project_deploy ! post_tasks: - name: Remove old releases deploy: "path={{ project_root }} state=clean"
  • 45. WHAT DOESN’T IT DO? 45 • Rollbacks (the cake rollback is a lie)
  • 46. WHAT DOESN’T IT DO? 46 • Rollbacks • Set maintenance mode (the cake rollback is a lie)
  • 47. WHAT DOESN’T IT DO? 47 • Rollbacks • Set maintenance mode • DB migrations (the cake rollback is a lie)
  • 48. WHAT’S NEXT? 48 • Full-blown Actions in addition to commands
  • 49. WHAT’S NEXT? 49 • Full-blown Actions in addition to commands • Setfacl support
  • 50. WHAT’S NEXT? 50 • Full-blown Actions in addition to commands • Setfacl support • Your ideas?
  • 51. THANKYOU! 51 Feedback: joind.in? https://github.com/f500/ansible-project_deploy (But we’re also people. You could just talk to us and tell us what you think…)