chd/deployments/mojobot/mojo.yml

26 lines
1.1 KiB
YAML
Raw Normal View History

2018-05-29 03:52:42 +00:00
- name: Deploy Mojo JoJo
hosts: dockerhosts
vars_files:
- mojo-vars-vault.yml
remote_user: josiah
tasks:
- name: print hostname
command: hostname
register: hostname
- debug: msg="{{ hostname.stdout }}"
- name: Pull latest version from github, or log an error if the dir doesn't exist'
2018-10-07 18:13:15 +00:00
shell: cd /home/josiah/mojojojo-bot/ && git pull
register: result
ignore_errors: True
- name: If previous step failed, clone repo down
shell: cd /home/josiah/ && git clone https://github.com/jowj/mojojojo-bot.git
when: result is failed
- name: Build from the latest version
shell: cd ~/mojojojo-bot && docker build -t mojo -f docker/dockerfile .
- name: Check if there are any existing mojo containers running and kill it
# this has to be a shell because command: isn't interactive
shell: docker ps | grep 'mojo' | awk '{print $1}' | xargs docker kill
ignore_errors: True
- name: Run the newly built docker container
command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ mojo