From 4721c5fa359af0f1c8a2f0a233d1867d698ab99e Mon Sep 17 00:00:00 2001 From: jowj Date: Tue, 28 May 2019 14:48:09 -0500 Subject: [PATCH] Update deploy.yml to be more forgiving of errors. - Each service deploy should be more flexible - many more 'if/when' declarations. --- applicationConfiguration/.emacs/init.el | 2 +- deployments/awful-1/deploy.yml | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/applicationConfiguration/.emacs/init.el b/applicationConfiguration/.emacs/init.el index 53518cd..006615f 100644 --- a/applicationConfiguration/.emacs/init.el +++ b/applicationConfiguration/.emacs/init.el @@ -73,7 +73,7 @@ jlj-Packages) (org-bbdb org-bibtex org-docview org-gnus org-habit org-info org-irc org-mhe org-rmail org-w3m))) '(package-selected-packages (quote - (smex twittering-mode znc eyebrowse helm racer flycheck-rust rust-mode color-theme-sanityinc-tomorrow org2blog multiple-cursors flymake-python-pyflakes pdf-tools weechat jedi python-mode pylint py-autopep8 powershell outline-magic markdown-mode magit flycheck exec-path-from-shell elpygen elpy ein doom-themes csharp-mode))) + (ansible yaml-mode smex twittering-mode znc eyebrowse helm racer flycheck-rust rust-mode color-theme-sanityinc-tomorrow org2blog multiple-cursors flymake-python-pyflakes pdf-tools weechat jedi python-mode pylint py-autopep8 powershell outline-magic markdown-mode magit flycheck exec-path-from-shell elpygen elpy ein doom-themes csharp-mode))) '(znc-servers (\` (("bouncer.awful.club" 5000 t diff --git a/deployments/awful-1/deploy.yml b/deployments/awful-1/deploy.yml index 24902d3..1a44035 100644 --- a/deployments/awful-1/deploy.yml +++ b/deployments/awful-1/deploy.yml @@ -37,8 +37,13 @@ command: hostname register: hostname - debug: msg="{{ hostname.stdout }}" - - name: Pull latest version from github + - name: update the directory, or log to register if dir doesn't exist' shell: cd /home/josiah/arke/ && git pull + register: result + ignore_errors: True + - name: Pull latest version from github + shell: cd /home/josiah/ && git clone https://github.com/jowj/arke.git + when: result is failed - name: Build from the latest version shell: cd ~/arke/ && docker build -t arke -f dockerfile . @@ -52,6 +57,7 @@ - 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 + ignore_errors: True - name: Run the newly built docker container command: docker run -d --name arke --mount source=towervol,target=/shared/ arke:latest @@ -69,12 +75,17 @@ shell: ls -la | grep 'mojo' register: ls - debug: msg="{{ ls.stdout }}" - - name: Pull latest version from github + - 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 + - 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 source=towervol,target=/shared/ mojo