chd/deployments/mojobot/mojo.yml

43 lines
1.9 KiB
YAML
Raw Normal View History

2019-07-29 21:31:08 +00:00
- name: setup mojo repo
hosts: prod
tasks:
- name: print hostname
command: hostname
register: hostname
- debug: msg="{{ hostname.stdout }}"
2019-07-29 21:31:08 +00:00
- name: try to update directory
shell: cd /home/josiah/mojojojo-bot && git pull
register: result
ignore_errors: True
2019-07-29 21:31:08 +00:00
- name: if the folder doesn't exist, clone from remote
shell: cd /home/josiah/ && git clone http://git.awful.club/hosted/mojojojo-bot.git
when: result is failed
2019-07-29 21:31:08 +00:00
- name: Deploy mojo webclient
hosts: prod
vars_files:
- vault-vars-mojo.yml
tasks:
- name: Build from the latest version
shell: cd /home/josiah/mojojojo-bot/mojo-web && docker build -t mojo-web -f dockerfile .
2019-07-29 21:31:08 +00:00
- name: Check if there are any existing mojo-web containers running and kill them
# this has to be a shell because command: isn't interactive
shell: docker ps | grep 'mojo-web' | 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-web
- name: Deploy mojo rtmclient
hosts: prod
vars_files:
- vault-vars-mojo.yml
tasks:
- name: Build from the latest version
shell: cd /home/josiah/mojojojo-bot/mojo-rtm && docker build -t mojo-rtm -f dockerfile .
2019-07-29 21:31:08 +00:00
- name: Check if there are any existing mojo-rtm containers running and kill them
# this has to be a shell because command: isn't interactive
2019-07-29 21:31:08 +00:00
shell: docker ps | grep 'mojo-rtm' | awk '{print $1}' | xargs docker kill
ignore_errors: True
- name: Run the newly built docker container
2019-07-29 21:31:08 +00:00
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-rtm