Created
April 10, 2015 18:01
-
-
Save evanscottgray/f76894653517176366ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Stop all running logspout containers | |
shell: "docker ps | sed -e '1d' | grep logspout | awk {'print $1'} | xargs docker stop || :" | |
ignore_errors: yes | |
when: force_pull | |
- name: delete all Logspout containers | |
shell: "docker ps -a | grep logspout | awk '{print $1}' | xargs docker rm -f || :" | |
ignore_errors: yes | |
when: force_pull | |
- name: Clean all Logspout images | |
shell: "docker images | sed -e '1d' | grep logspout | awk {'print $3'} | xargs docker rmi -f || :" | |
when: force_pull | |
- name: Remove old image | |
shell: docker rmi -f {{ docker_image }} | |
ignore_errors: yes | |
when: force_pull | |
- name: Pull new image | |
shell: docker pull {{ docker_image }} | |
ignore_errors: yes | |
when: force_pull | |
- name: Remove old container gracefully | |
docker: | |
image: "{{ docker_image }}" | |
state: absent | |
when: restart_logspout | |
- name: Start Logspout Container | |
docker: | |
state: running | |
name: "{{ container_name }}" | |
image: "{{ docker_image }}" | |
registry: https://index.docker.io/v1/ | |
command: syslog://{{ papertrail_url }} | |
hostname: "{{ ansible_fqdn }}" | |
volumes: | |
- '/var/run/docker.sock:/tmp/docker.sock' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where is "restart_logspout" defined, or how is it defined? Another part of playbook?