From 22867caacbe623bcae3a25cbbf25fc328149a8c7 Mon Sep 17 00:00:00 2001 From: jowj Date: Tue, 28 May 2019 13:38:18 -0500 Subject: [PATCH] Add temp bulk deploy file. --- deployments/awful-1/deploy.yml | 80 +++++++++++++++++++++++++ deployments/awful-1/hosts.yml | 16 +++++ deployments/awful-1/mojo-vars-vault.yml | 9 +++ 3 files changed, 105 insertions(+) create mode 100644 deployments/awful-1/deploy.yml create mode 100644 deployments/awful-1/hosts.yml create mode 100644 deployments/awful-1/mojo-vars-vault.yml diff --git a/deployments/awful-1/deploy.yml b/deployments/awful-1/deploy.yml new file mode 100644 index 0000000..bff9a9c --- /dev/null +++ b/deployments/awful-1/deploy.yml @@ -0,0 +1,80 @@ +- name: deploy znc server + hosts: dockerhosts + remote_user: josiah + tasks: + - name: update or create the directory + shell: cd /home/josiah/znc-docker/ && git pull + register: result + ignore_errors: True + + # if the folder doesn't exist, clone source. + - command: cd /home/josiah && git clone https://github.com/jowj/znc-docker.git + 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 }}" + - name: Pull latest version from github + shell: cd /home/josiah/arke/ && git pull + - 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 + - name: Run the newly built docker container + command: docker run -d --name arke --mount source=towervol,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: print working directory + shell: ls -la | grep 'mojo' + register: ls + - debug: msg="{{ ls.stdout }}" + - name: Pull latest version from github + shell: cd /home/josiah/mojojojo-bot/ && git pull + - 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 + - name: Run the newly built docker container + command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount source=towervol,target=/shared/ mojo diff --git a/deployments/awful-1/hosts.yml b/deployments/awful-1/hosts.yml new file mode 100644 index 0000000..947f4b6 --- /dev/null +++ b/deployments/awful-1/hosts.yml @@ -0,0 +1,16 @@ +all: + children: + dockerhosts: + hosts: + awful-1.awful.club: + vars: + ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q ansible@ssh.awful.club"' + macs: + hosts: + hydra-ling: + windows: + hosts: + lurker-ling: + linux: + hosts: + ling-bane: diff --git a/deployments/awful-1/mojo-vars-vault.yml b/deployments/awful-1/mojo-vars-vault.yml new file mode 100644 index 0000000..c608b41 --- /dev/null +++ b/deployments/awful-1/mojo-vars-vault.yml @@ -0,0 +1,9 @@ +$ANSIBLE_VAULT;1.1;AES256 +62306462666461356361643838636461396665633234363731396465643663373731343438363062 +6166323433353631366639663933653439333961353539610a343234383436666463326161613538 +32396161616537363261643965616439333637346535643136643732623939346538623534336236 +3339643664633834630a323464376464343832636265623362353337316139333164613237323964 +38616264346536623633623337613363646262313637313431323666393537623665626262643963 +30316162303330396663636537633766333065386435376462653661653666323734363564323466 +33303738363731376363663935383439616363383238346537326363343330386361613363623662 +65663634363636633937