2018-05-29 03:52:42 +00:00
|
|
|
- name: Deploy Mojo JoJo
|
|
|
|
hosts: dockerhosts
|
|
|
|
vars_files:
|
|
|
|
- mojo-vars-vault.yml
|
2018-05-22 03:26:12 +00:00
|
|
|
remote_user: josiah
|
|
|
|
tasks:
|
2018-10-07 06:31:49 +00:00
|
|
|
- name: print hostname
|
|
|
|
command: hostname
|
|
|
|
register: hostname
|
|
|
|
- debug: msg="{{ hostname.stdout }}"
|
|
|
|
- name: print working directory
|
|
|
|
shell: ls -la | grep 'mojo'
|
|
|
|
register: ls
|
|
|
|
- debug: msg="{{ ls.stdout }}"
|
2018-05-22 03:26:12 +00:00
|
|
|
- name: Pull latest version from github
|
2018-10-07 18:13:15 +00:00
|
|
|
shell: cd /home/josiah/mojojojo-bot/ && git pull
|
2018-05-22 03:26:12 +00:00
|
|
|
- name: Build from the latest version
|
2018-10-07 06:31:49 +00:00
|
|
|
shell: cd ~/mojojojo-bot && docker build -t mojo -f docker/dockerfile .
|
2018-06-02 16:03:54 +00:00
|
|
|
- name: Check if there are any existing mojo containers running and kill it
|
2018-06-02 16:36:48 +00:00
|
|
|
# this has to be a shell because command: isn't interactive
|
2018-10-07 19:00:45 +00:00
|
|
|
shell: docker ps | grep -E 'Up|Restarting' | awk '{print $1}' | xargs docker kill
|
2018-05-22 03:26:12 +00:00
|
|
|
- name: Run the newly built docker container
|
2018-10-07 21:26:39 +00:00
|
|
|
command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount source=towervol,target=/shared/ mojo
|