2019-07-29 21:31:08 +00:00
|
|
|
- name: setup mojo repo
|
|
|
|
hosts: prod
|
2018-05-22 03:26:12 +00:00
|
|
|
tasks:
|
2018-10-07 06:31:49 +00:00
|
|
|
- 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
|
2019-05-30 22:44:17 +00:00
|
|
|
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
|
2019-05-30 22:44:17 +00:00
|
|
|
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
|
2019-07-29 21:42:47 +00:00
|
|
|
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:
|
2018-05-22 03:26:12 +00:00
|
|
|
- name: Build from the latest version
|
2019-07-29 21:42:47 +00:00
|
|
|
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
|
2018-06-02 16:36:48 +00:00
|
|
|
# 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
|
2019-05-30 22:44:17 +00:00
|
|
|
ignore_errors: True
|
2018-05-22 03:26:12 +00:00
|
|
|
- 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
|