You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
990 B

- 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: print working directory
shell: ls -la | grep 'mojo'
register: ls
- debug: msg="{{ ls.stdout }}"
- name: Pull latest version from github
shell: cd /home/josiah/mojojojo-bot/ && git pull
- 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
- name: Run the newly built docker container
command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount source=towervol,target=/shared/ mojo