Files
wrestlingdev-ansible/playbooks/code-deploy.yml

38 lines
1.3 KiB
YAML

---
# This playbook deploys the whole application stack for wrestlingdev
#
- hosts: web
remote_user: root
serial: 1
tasks:
- name: Refresh code
command: chdir=/root/wrestlingApp git pull origin master
- name: Create apache docker image
command: chdir=/root/wrestlingApp docker build -t wrestlingdev-web -f rails-prod-Dockerfile .
- name: Kill running docker container
shell: docker stop $(docker ps -a -q)
- name: Start docker container
command: docker run -h {{ansible_hostname}} -d --restart=always --env-file /root/prod.env -v /srv/docker/apache2/logs:/var/log/apache2 -v /etc/localtime:/etc/localtime -p 80:80 -p 443:443 wrestlingdev-web
- hosts: worker
remote_user: root
serial: 1
tasks:
- name: Refresh code
command: chdir=/root/wrestlingApp git pull origin master
- name: Create apache docker image
command: chdir=/root/wrestlingApp docker build -t wrestlingdev-worker -f rails-prod-Dockerfile .
- name: Kill running docker container
shell: docker stop $(docker ps -a -q)
- name: Start docker container
command: docker run -h {{ansible_hostname}} -d --restart=always --env-file /root/prod.env -v /etc/localtime:/etc/localtime wrestlingdev-worker bundle exec rake jobs:work RAILS_ENV=production