Update deploy.yml to be more forgiving of errors.

- Each service deploy should be more flexible
- many more 'if/when' declarations.
This commit is contained in:
jowj 2019-05-28 14:48:09 -05:00
parent 95f471afa4
commit 4721c5fa35
2 changed files with 14 additions and 3 deletions

View File

@ -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))) (org-bbdb org-bibtex org-docview org-gnus org-habit org-info org-irc org-mhe org-rmail org-w3m)))
'(package-selected-packages '(package-selected-packages
(quote (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 '(znc-servers
(\` (\`
(("bouncer.awful.club" 5000 t (("bouncer.awful.club" 5000 t

View File

@ -37,8 +37,13 @@
command: hostname command: hostname
register: hostname register: hostname
- debug: msg="{{ hostname.stdout }}" - 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 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 - name: Build from the latest version
shell: cd ~/arke/ && docker build -t arke -f dockerfile . 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 - 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 # this has to be a shell because command: isn't interactive
shell: docker container rm arke shell: docker container rm arke
ignore_errors: True
- name: Run the newly built docker container - name: Run the newly built docker container
command: docker run -d --name arke --mount source=towervol,target=/shared/ arke:latest command: docker run -d --name arke --mount source=towervol,target=/shared/ arke:latest
@ -69,12 +75,17 @@
shell: ls -la | grep 'mojo' shell: ls -la | grep 'mojo'
register: ls register: ls
- debug: msg="{{ ls.stdout }}" - 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 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 - name: Build from the latest version
shell: cd ~/mojojojo-bot && docker build -t mojo -f docker/dockerfile . shell: cd ~/mojojojo-bot && docker build -t mojo -f docker/dockerfile .
- name: Check if there are any existing mojo containers running and kill it - name: Check if there are any existing mojo containers running and kill it
# this has to be a shell because command: isn't interactive # 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' | awk '{print $1}' | xargs docker kill
ignore_errors: True
- name: Run the newly built docker container - 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 command: docker container run -e "SLACK_BOT_TOKEN={{ VAULT_SLACK_BOT_TOKEN }}" --restart "always" -d --mount source=towervol,target=/shared/ mojo