Browse Source

Add zuul-registry crontab entry

This is so we can prune images regularly.

Change-Id: If1d34ac0a6c2eece92b854e6fe0bdf3602fbb02b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
changes/99/764799/3
Paul Belanger 1 year ago
parent
commit
854912f814
  1. 6
      defaults/main.yaml
  2. 9
      tasks/config.yaml
  3. 4
      templates/etc/cron.d/zuul-registry.j2
  4. 13
      tests/playbooks/run.yaml

6
defaults/main.yaml

@ -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_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
zuul_registry_git_dest: "{{ ansible_user_dir }}/src/opendev.org/zuul/zuul-registry"
zuul_registry_git_uri: https://opendev.org/zuul/zuul-registry

9
tasks/config.yaml

@ -53,3 +53,12 @@
owner: "{{ zuul_registry_file_ssl_key_owner }}"
src: "{{ zuul_registry_file_ssl_key_src }}"
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 }}"

4
templates/etc/cron.d/zuul-registry.j2

@ -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

13
tests/playbooks/run.yaml

@ -91,6 +91,19 @@
- zuul_registry_git_dest_stat.stat.isdir
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
stat:
path: /etc/systemd/system/zuul-registry.service

Loading…
Cancel
Save