2019-05-28 18:38:18 +00:00
|
|
|
- name: deploy znc server
|
|
|
|
hosts: dockerhosts
|
|
|
|
remote_user: josiah
|
|
|
|
tasks:
|
|
|
|
- name: update or create the directory
|
2019-05-28 19:32:05 +00:00
|
|
|
shell: cd /home/josiah/znc-docker/ && git pull
|
2019-05-28 18:38:18 +00:00
|
|
|
register: result
|
|
|
|
ignore_errors: True
|
|
|
|
|
|
|
|
# if the folder doesn't exist, clone source.
|
2019-05-28 19:32:05 +00:00
|
|
|
- shell: cd /home/josiah && git clone https://github.com/jowj/znc-docker.git
|
2019-05-28 18:38:18 +00:00
|
|
|
when: result is failed
|
|
|
|
- name: build from latest version
|
|
|
|
shell: cd ~/znc-docker/full && docker build -t znc -f Dockerfile .
|
|
|
|
- name: Check if there are any existing ZNC containers running and kill it
|
|
|
|
shell: docker ps | grep 'znc' | awk '{print $1}'
|
|
|
|
register: result
|
|
|
|
- name: if there are running containers, remove them
|
|
|
|
shell: docker ps | grep 'znc' | awk '{print $1}' | xargs docker kill
|
|
|
|
when: result.stdout != ""
|
|
|
|
- name: discover if any containers with ZNC in name
|
|
|
|
# this has to be a shell because command: isn't interactive
|
|
|
|
shell: docker container ls | grep 'znc'
|
|
|
|
register: result
|
|
|
|
ignore_errors: True
|
|
|
|
- name: remove any existing containers with ZNC in name
|
|
|
|
shell: docker container rm znc
|
|
|
|
when: result is succeeded
|
|
|
|
- name: run the container (assumes the volume is already set up)
|
|
|
|
command: docker run -d -p 5000:5000 --mount type="bind",source="/mnt/volume_sfo2_znc/",target=/znc-data znc
|
|
|
|
|
|
|
|
- name: Deploy Arke
|
|
|
|
hosts: dockerhosts
|
|
|
|
remote_user: josiah
|
|
|
|
tasks:
|
|
|
|
- name: Get hostname for troubleshooting
|
|
|
|
command: hostname
|
|
|
|
register: hostname
|
|
|
|
- debug: msg="{{ hostname.stdout }}"
|
2019-05-28 19:48:09 +00:00
|
|
|
- name: update the directory, or log to register if dir doesn't exist'
|
2019-05-28 18:38:18 +00:00
|
|
|
shell: cd /home/josiah/arke/ && git pull
|
2019-05-28 19:48:09 +00:00
|
|
|
register: result
|
|
|
|
ignore_errors: True
|
2019-05-28 22:09:33 +00:00
|
|
|
- name: If last step failed, clone the repo.
|
2019-05-28 19:48:09 +00:00
|
|
|
shell: cd /home/josiah/ && git clone https://github.com/jowj/arke.git
|
|
|
|
when: result is failed
|
2019-05-28 18:38:18 +00:00
|
|
|
- name: Build from the latest version
|
|
|
|
shell: cd ~/arke/ && docker build -t arke -f dockerfile .
|
|
|
|
|
|
|
|
- name: Check if there are any existing arke containers running
|
|
|
|
shell: docker ps | grep 'arke' | awk '{print $1}'
|
|
|
|
register: result
|
|
|
|
- name: and kill it
|
|
|
|
# this has to be a shell because command: isn't interactive
|
|
|
|
shell: docker ps | grep 'arke' | awk '{print $1}' | xargs docker kill
|
|
|
|
when: result.stdout != ""
|
|
|
|
- name: Remove any existing containers using the arke name, its mine and i must have it
|
|
|
|
# this has to be a shell because command: isn't interactive
|
|
|
|
shell: docker container rm arke
|
2019-05-28 19:48:09 +00:00
|
|
|
ignore_errors: True
|
2019-05-28 18:38:18 +00:00
|
|
|
- name: Run the newly built docker container
|
2019-05-28 21:08:05 +00:00
|
|
|
command: docker run -d --name arke --mount type="bind",source="/mnt/volume_sfo2_znc",target=/shared/ arke:latest
|
2019-05-28 18:38:18 +00:00
|
|
|
|
|
|
|
- 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 }}"
|
2019-05-28 19:48:09 +00:00
|
|
|
- name: Pull latest version from github, or log an error if the dir doesn't exist'
|
2019-05-28 18:38:18 +00:00
|
|
|
shell: cd /home/josiah/mojojojo-bot/ && git pull
|
2019-05-28 19:48:09 +00:00
|
|
|
register: result
|
2019-05-28 20:01:13 +00:00
|
|
|
ignore_errors: True
|
2019-05-28 19:48:09 +00:00
|
|
|
- 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
|
2019-05-28 18:38:18 +00:00
|
|
|
- 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
|
2019-05-28 19:48:09 +00:00
|
|
|
ignore_errors: True
|
2019-05-28 18:38:18 +00:00
|
|
|
- name: Run the newly built docker container
|
2019-05-28 21:08:05 +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
|