2018-10-07 21:27:08 +00:00
|
|
|
- name: Deploy Arke
|
|
|
|
hosts: dockerhosts
|
|
|
|
remote_user: josiah
|
|
|
|
tasks:
|
|
|
|
- name: Get hostname for troubleshooting
|
|
|
|
command: hostname
|
|
|
|
register: hostname
|
|
|
|
- debug: msg="{{ hostname.stdout }}"
|
|
|
|
- name: Pull latest version from github
|
|
|
|
shell: cd /home/josiah/arke/ && git pull
|
|
|
|
- name: Build from the latest version
|
2018-10-07 21:32:27 +00:00
|
|
|
shell: cd ~/arke/ && docker build -t arke -f dockerfile .
|
2018-12-03 01:59:15 +00:00
|
|
|
|
|
|
|
- name: Check if there are any existing arke containers running
|
|
|
|
shell: docker ps | grep 'arke' | awk '{print $1}'
|
|
|
|
register: result
|
|
|
|
- name: and kill it
|
2018-10-07 21:27:08 +00:00
|
|
|
# this has to be a shell because command: isn't interactive
|
|
|
|
shell: docker ps | grep 'arke' | awk '{print $1}' | xargs docker kill
|
2018-12-03 01:59:15 +00:00
|
|
|
when: result.stdout != ""
|
2018-10-07 22:42:19 +00:00
|
|
|
- name: Remove any existing containers using the arke name, its mine and i must have it
|
|
|
|
# this has to be a shell because command: isn't interactive
|
|
|
|
shell: docker container rm arke
|
2018-10-07 21:27:08 +00:00
|
|
|
- name: Run the newly built docker container
|
|
|
|
command: docker run -d --name arke --mount source=towervol,target=/shared/ arke:latest
|