Add the cron to run the ami deletion regularly

This commit is contained in:
Sayan Chowdhury 2019-05-29 21:46:38 +00:00
parent a3076d40a0
commit 1709ce142d
2 changed files with 19 additions and 1 deletions

View file

@ -90,13 +90,21 @@
- python2-koji-cli-plugins
- python3-koji-cli-plugins
- python2-koji
- python3-fedfind
- python3-fedfind # needed by clean-amis.py script
- python3-boto # needed by clean-amis.py script
- python3-requests # needed by clean-amis.py script
- make
- nosync
- pygobject3
tags:
- releng
- name: add pkgs from testing repo
dnf: state=present pkg={{ item }} enablerepo=infrastructure-tags-stg
with_items:
- python3-libpagure
when: testing
- name: add pkgs
dnf: state=present pkg={{ item }}
with_items:
@ -147,6 +155,11 @@
copy: src="container-updates" dest=/etc/cron.d/container-updates
when: inventory_hostname.startswith('compose-x86-01')
# put cron job in for regular ami deletion
- name: clean-amis cron
template: src=clean-amis.j2 dest=/etc/cron.d/clean-amis
when: inventory_hostname.startswith('compose-x86-01')
- name: install compose /etc/httpd/conf.d/compose.conf file
copy: >
src="compose.conf"

View file

@ -0,0 +1,5 @@
# Remove launch permissions from the AMIs after everyday
0 22 * * * root TMPDIR=`mktemp -d /tmp/purgeamis.XXXXXX` && pushd $TMPDIR && git clone -n https://pagure.io/releng.git && cd releng/scripts && AWS_ACCESS_KEY={{ ec2_image_delete_access_key_id }} AWS_SECRET_ACCESS_KEY={{ ec2_image_delete_access_key }} PAGURE_ACCESS_TOKEN={{ ami_purge_report_api_key }} ./clean-amis.py --change-perms --days 7 --permswaitperiod 5 && popd && rm -rf $TMPDIR
# Delete the AMIs after everyday
0 23 * * * root TMPDIR=`mktemp -d /tmp/purgeamis.XXXXXX` && pushd $TMPDIR && git clone -n https://pagure.io/releng.git && cd releng/scripts && AWS_ACCESS_KEY={{ ec2_image_delete_access_key_id }} AWS_SECRET_ACCESS_KEY={{ ec2_image_delete_access_key }} PAGURE_ACCESS_TOKEN={{ ami_purge_report_api_key }} ./clean-amis.py --delete --days 17 --deletewaitperiod 10 && popd && rm -rf $TMPDIR