Skip to content

Commit

Permalink
mv docker-rotate images opt to config
Browse files Browse the repository at this point in the history
AWS-196
  • Loading branch information
Patrick Boyd committed May 16, 2016
1 parent eb56494 commit 6be6364
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ docker_py_version: 1.2.3
docker_rotate_version: 2.0.1


# Python regex of image names to remove. Use a '~' prefix for negative match.
#
# https://github.com/locationlabs/docker-rotate
docker_rotate_containers_images_filter: ~busybox

# Log rotate interval. Log files will be rotated after this interval.

docker_log_rotate_interval: "daily"
Expand Down
8 changes: 0 additions & 8 deletions files/docker-rotate

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
pip: name=dockerrotate version="{{ docker_rotate_version}}"

- name: install docker-rotate cron script
copy: src=docker-rotate dest=/etc/cron.daily/ mode=755
template: src=docker-rotate dest=/etc/cron.daily/ mode=755

- name: push logrotate config file for docker container json logs
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/docker
Expand Down
7 changes: 7 additions & 0 deletions templates/docker-rotate
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Remove docker images keeping the last 3 of each type
docker-rotate images --keep 3
# Remove docker containers that have exited over an hour ago
# and were created over a day ago
docker-rotate containers --exited 1h --created 1d --images {{ docker_rotate_containers_images_filter }}

0 comments on commit 6be6364

Please sign in to comment.