Add zuul-registry crontab entry

This is so we can prune images regularly.

Change-Id: If1d34ac0a6c2eece92b854e6fe0bdf3602fbb02b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2020-11-30 11:55:16 -05:00
parent d940e20ce1
commit 854912f814
4 changed files with 32 additions and 0 deletions

View File

@ -46,6 +46,12 @@ zuul_registry_file_ssl_key_mode: 0600
zuul_registry_file_ssl_key_owner: "{{ zuul_registry_user_name }}" zuul_registry_file_ssl_key_owner: "{{ zuul_registry_user_name }}"
zuul_registry_file_ssl_key_src: etc/zuul-registry/ssl/cert.key zuul_registry_file_ssl_key_src: etc/zuul-registry/ssl/cert.key
zuul_registry_file_crontab_dest: /etc/cron.d/zuul-registry
zuul_registry_file_crontab_group: root
zuul_registry_file_crontab_mode: 0644
zuul_registry_file_crontab_owner: root
zuul_registry_file_crontab_src: etc/cron.d/zuul-registry.j2
# tasks/install.yaml # tasks/install.yaml
zuul_registry_git_dest: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry" zuul_registry_git_dest: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry"
zuul_registry_git_uri: https://opendev.org/zuul/zuul-registry zuul_registry_git_uri: https://opendev.org/zuul/zuul-registry

View File

@ -53,3 +53,12 @@
owner: "{{ zuul_registry_file_ssl_key_owner }}" owner: "{{ zuul_registry_file_ssl_key_owner }}"
src: "{{ zuul_registry_file_ssl_key_src }}" src: "{{ zuul_registry_file_ssl_key_src }}"
register: zuul_registry_file_ssl_key register: zuul_registry_file_ssl_key
- name: Install zuul-registry crontab
become: true
template:
dest: "{{ zuul_registry_file_crontab_dest }}"
group: "{{ zuul_registry_file_crontab_group }}"
mode: "{{ zuul_registry_file_crontab_mode }}"
owner: "{{ zuul_registry_file_crontab_owner }}"
src: "{{ zuul_registry_file_crontab_src }}"

View File

@ -0,0 +1,4 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
0 3 * * * {{ zuul_registry_user_name }} {{ zuul_registry_pip_virtualenv | default('/usr/local') }}/bin/zuul-regsitry -c {{ zuul_registry_file_registry_yaml_dest }} prune

View File

@ -91,6 +91,19 @@
- zuul_registry_git_dest_stat.stat.isdir - zuul_registry_git_dest_stat.stat.isdir
when: zuul_registry_install_method == 'git' when: zuul_registry_install_method == 'git'
- name: Register /etc/cron.d/zuul-registry
stat:
path: /etc/cron.d/zuul-registry
register: zuul_registry_crontab_stat
- name: Assert zuul_registry_crontab_stat tests
assert:
that:
- zuul_registry_crontab_stat.stat.exists
- zuul_registry_crontab_stat.stat.isreg
- zuul_registry_crontab_stat.stat.pw_name == 'root'
- zuul_registry_crontab_stat.stat.gr_name == 'root'
- name: Register /etc/systemd/system/zuul-registry.service - name: Register /etc/systemd/system/zuul-registry.service
stat: stat:
path: /etc/systemd/system/zuul-registry.service path: /etc/systemd/system/zuul-registry.service