24 lines
912 B
YAML
24 lines
912 B
YAML
---
|
|
# This task clones the repo and runs the webserver 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-web -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 != ""
|
|
ignore_errors: yes
|
|
|
|
- name: Start docker container
|
|
command: docker run -h {{ansible_hostname}} --name wrestlingdev-web -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
|
|
#when: wrestlingdev_running == ""
|
|
ignore_errors: yes
|