Add logic to prevent hard errors when running shell commands.

pull/1/head
jowj 6 years ago
parent 6dea355a61
commit 56b1034196

@ -12,11 +12,19 @@
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 mojo containers running and kill it
- 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
- name: Remove any existing containers using the znc name, its mine and i must have it
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
- name: remove any existing containers with ZNC in name
shell: docker container rm znc
when: result.stdout != ""
- name: run the container (assumes the volume is already set up)
command: docker run -d -p 5000:5000 -v znc-cfg:/znc-data znc

Loading…
Cancel
Save