add conjob option
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-08-01 21:44:58 +02:00
parent 206b1e4d53
commit d1cd0b73d1
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
2 changed files with 35 additions and 8 deletions

View File

@ -31,3 +31,17 @@ minio_access_key: "demo"
# @var minio_secret_key:description: Minio secret key (should be changed for prod environments)
minio_secret_key: "passphrase"
minio_cronjobs: []
# @var minio_cronjobs:example: >
# minio_cronjobs:
# - name: maintenance
# minute: "0"
# hour: "0"
# day: "*"
# month: "*"
# weekday: "*"
# job: "mc rm --older-than 30d --recursive --force my_bucket/logs"
# user: "{{ minio_user }}"
# cron_file: "minio"
# @end

View File

@ -25,15 +25,28 @@
become: True
become_user: "{{ minio_user }}"
- name: Download Minio client
get_url:
url: "{{ __minio_client_source }}{{ '/' + minio_client_version if minio_client_version != 'latest' else '/mc' }}"
dest: "/usr/local/bin/mc"
mode: 0755
become: True
become_user: root
- block:
- name: Download Minio client
get_url:
url: "{{ __minio_client_source }}{{ '/' + minio_client_version if minio_client_version != 'latest' else '/mc' }}"
dest: "/usr/local/bin/mc"
mode: 0755
- name: Create cronjobs
cron:
name: "{{ item.name }}"
minute: "{{ item.minute | default('*') }}"
hour: "{{ item.hour | default('*') }}"
day: "{{ item.day | default('*') }}"
month: "{{ item.month | default('*') }}"
weekday: "{{ item.weekday | default('*') }}"
job: "{{ item.job }}"
user: "{{ item.user | default(omit) }}"
cron_file: "{{ item.cron_file | default(omit) }}"
loop: "{{ minio_cronjobs }}"
loop_control:
label: "{{ item.name }}"
- name: Copy sysconfig file
template:
src: "etc/sysconfig/minio.j2"