mirror of
https://github.com/koodiklinikka/playbooks.git
synced 2026-01-26 03:03:59 +00:00
22 lines
649 B
YAML
22 lines
649 B
YAML
---
|
|
|
|
- name: get running container
|
|
shell: docker ps -a|grep {{ koodiklinikka_container_name }}|grep latest| awk '{print $1}'
|
|
register: current_container_id
|
|
|
|
- name: kill old version
|
|
shell: docker stop {{ koodiklinikka_container_name }}
|
|
when: current_container_id != ""
|
|
|
|
- name: get old containers
|
|
shell: docker ps -a|grep Exited| awk '{print $1}'
|
|
register: old_containers
|
|
|
|
- name: clean old containers
|
|
shell: docker rm $(docker ps -a|grep Exited| awk '{print $1}')
|
|
when: old_containers.stdout != ""
|
|
|
|
- name: Start the container
|
|
shell: docker run -d --name {{ koodiklinikka_container_name }} {{ koodiklinikka_container_name }}:old
|
|
|