Skip to content

Instantly share code, notes, and snippets.

@evanscottgray
Created April 10, 2015 18:01
Show Gist options
  • Save evanscottgray/f76894653517176366ff to your computer and use it in GitHub Desktop.
Save evanscottgray/f76894653517176366ff to your computer and use it in GitHub Desktop.
---
- 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'
@tetheredge
Copy link

Where is "restart_logspout" defined, or how is it defined? Another part of playbook?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment