Created
August 13, 2015 08:16
-
-
Save reiz/238e70683bbfbc10bf4c to your computer and use it in GitHub Desktop.
Ansible Playbook for seamless deployment with Docker.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: app_server_1 | |
user: ubuntu | |
sudo: true | |
roles: | |
- docker_rails_app_build | |
- hosts: app_loadbalancer | |
user: ubuntu | |
sudo: true | |
tasks: | |
- name: take app_1 out of balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="server {{app_server_1}}\:8080\;" replace='# server {{app_server_1}}:8080;' backup=false | |
- name: restart nginx | |
shell: service nginx restart | |
- hosts: app_server_1 | |
user: ubuntu | |
sudo: true | |
roles: | |
- docker_rails_app_run_prod | |
- docker_rails_app_push | |
- hosts: app_loadbalancer | |
user: ubuntu | |
sudo: true | |
tasks: | |
- name: take app_1 back to balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="\# server {{app_server_1}}\:8080\;" replace='server {{app_server_1}}:8080;' backup=false | |
- name: take app_2 out of balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="server {{app_server_2}}\:8080\;" replace='# server {{app_server_2}}:8080;' backup=false | |
- name: restart nginx | |
shell: service nginx restart | |
- hosts: app_server_2 | |
user: ubuntu | |
sudo: true | |
roles: | |
- docker_rails_app_run_prod | |
- hosts: app_loadbalancer | |
user: ubuntu | |
sudo: true | |
tasks: | |
- name: wait a minute until Docker container is up and running | |
pause: minutes=1 | |
- name: take app_2 back to balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="\# server {{app_server_2}}\:8080\;" replace='server {{app_server_2}}:8080;' backup=false | |
- name: take app_3 out of balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="server {{app_server_3}}\:8080\;" replace='# server {{app_server_3}}:8080;' backup=false | |
- name: restart nginx | |
shell: service nginx restart | |
- hosts: app_server_3 | |
user: ubuntu | |
sudo: true | |
roles: | |
- docker_rails_app_run_prod | |
- hosts: app_loadbalancer | |
user: ubuntu | |
sudo: true | |
tasks: | |
- name: wait a minute until Docker container is up and running | |
pause: minutes=1 | |
- name: take app_3 back to balancing | |
replace: dest=/etc/nginx/conf.d/default.conf regexp="\# server {{app_server_3}}\:8080\;" replace='server {{app_server_3}}:8080;' backup=false | |
- name: restart nginx | |
shell: service nginx restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment