Compare commits

...

2 Commits

Author SHA1 Message Date
e0459cc689 Restructure deploy for mojo-jojo. 2019-07-29 16:31:08 -05:00
125211bf82 Rename mojo vault vars file 2019-07-29 16:30:57 -05:00
3 changed files with 36 additions and 22 deletions

View File

@ -1,14 +1,11 @@
all:
children:
dockerhosts:
prod:
hosts:
# 10.30.12.41 is the secops-utils ip
monitoring.awful.club:
macs:
ansible_user: josiah
ansible_timeout: 100
dev:
hosts:
hydra-ling:
windows:
hosts:
lurker-ling:
linux:
hosts:
ling-bane:
localhost:

View File

@ -1,25 +1,42 @@
- name: Deploy Mojo JoJo
hosts: dockerhosts
vars_files:
- mojo-vars-vault.yml
remote_user: josiah
- name: setup mojo repo
hosts: prod
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
- name: try to update directory
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
- 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 ~/mojojojo-bot && docker build -t mojo -f docker/dockerfile .
- name: Check if there are any existing mojo containers running and kill it
shell: cd /home/josiah/mojojojo-bot/webclient && 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' | awk '{print $1}' | xargs docker kill
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
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/webclient && 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