Update individual deploy; copy changes to group deploy script.

This commit is contained in:
jowj 2019-07-29 16:42:47 -05:00
parent e0459cc689
commit fb9f5862a4
2 changed files with 45 additions and 28 deletions

View File

@ -1,3 +1,46 @@
- name: setup mojo repo
hosts: prod
tasks:
- name: print hostname
command: hostname
register: hostname
- debug: msg="{{ hostname.stdout }}"
- name: try to update directory
shell: cd /home/josiah/mojojojo-bot && git pull
register: result
ignore_errors: True
- 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
- 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 .
- 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 .
- 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
shell: docker ps | grep 'mojo-rtm' | 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-rtm
- name: deploy znc server
hosts: dockerhosts
remote_user: josiah
@ -60,29 +103,3 @@
ignore_errors: True
- name: Run the newly built docker container
command: docker run -d --name arke --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ arke:latest
- 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'
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

View File

@ -19,7 +19,7 @@
- vault-vars-mojo.yml
tasks:
- name: Build from the latest version
shell: cd /home/josiah/mojojojo-bot/webclient && docker build -t mojo-web -f dockerfile .
shell: cd /home/josiah/mojojojo-bot/mojo-web && docker build -t mojo-web -f dockerfile .
- 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
@ -33,7 +33,7 @@
- vault-vars-mojo.yml
tasks:
- name: Build from the latest version
shell: cd /home/josiah/mojojojo-bot/webclient && docker build -t mojo-rtm -f dockerfile .
shell: cd /home/josiah/mojojojo-bot/mojo-rtm && docker build -t mojo-rtm -f dockerfile .
- 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
shell: docker ps | grep 'mojo-rtm' | awk '{print $1}' | xargs docker kill