22 lines
857 B
YAML
22 lines
857 B
YAML
---
|
|
# This task clones the repo and runs the worker docker container.
|
|
#
|
|
- name: Copy the code from repository
|
|
git: repo={{ repository }} dest=/root/wrestlingApp
|
|
|
|
- name: Create apache docker image
|
|
command: chdir=/root/wrestlingApp docker build -t wrestlingdev-worker -f rails-prod-Dockerfile .
|
|
|
|
- name: Is wrestlingdev running
|
|
command: docker ps | grep wrestlingdev
|
|
register: wrestlingdev_running
|
|
ignore_errors: yes
|
|
|
|
- name: Kill and remove container
|
|
command: docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
|
|
when: wrestlingdev_running != ""
|
|
|
|
- name: Start docker container
|
|
command: docker run -h {{ansible_hostname}} --name wrestlingdev-worker -d --restart=always --env-file /root/prod.env -v /etc/localtime:/etc/localtime wrestlingdev-worker bundle exec rake jobs:work RAILS_ENV=production
|
|
when: wrestlingdev_running == ""
|