Skip to content

Commit

Permalink
Add support for cron job env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
ioigoume committed Jan 12, 2022
1 parent d6573f9 commit 7663ee0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
16 changes: 14 additions & 2 deletions roles/comanage-registry-plugins/tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---

- name: Add ENV vars in cron.d file
cron:
name: "{{ item.name }}"
job: "{{ item.job }}"
user: "{{ item.user }}"
env: yes
cron_file: "{{ item.filename }}"
state: present
loop: "{{ comanage_plugins_cron_env | default([]) }}"
become: true
when: comanage_plugins_cron_env is defined and comanage_plugins_cron_jobs is defined and comanage_plugins_cron_jobs_enabled

- name: Ensure COmanage Registry Plugins cron jobs are installed
cron:
name: "{{ item.name }}"
Expand All @@ -24,6 +36,6 @@
state: link
owner: root
group: root
loop: "{{ comanage_symlinks | default([]) }}"
loop: "{{ comanage_plugins_symlinks | default([]) }}"
become: true
when: comanage_symlinks is defined
when: comanage_plugins_symlinks is defined
8 changes: 4 additions & 4 deletions roles/comanage-registry-plugins/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
file: install.yml
apply:
tags:
- install
- comanage-registry-plugins:install
loop: "{{ comanage_registry_plugins|flatten(levels=1) }}"
tags:
- install
- comanage-registry-plugins:install

# Include configuration tasks
- name: Include Configure tasks
include_tasks:
file: configure.yml
apply:
tags:
- configure
- comanage-registry-plugins:configure
tags:
- configure
- comanage-registry-plugins:configure
12 changes: 12 additions & 0 deletions roles/comanage-registry/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@
tags:
- comanage-registry:config:core

- name: Add ENV vars in cron.d file
cron:
name: "{{ item.name }}"
job: "{{ item.job }}"
user: "{{ item.user }}"
env: yes
cron_file: "{{ item.filename }}"
state: present
loop: "{{ comanage_cron_env | default([]) }}"
become: true
when: comanage_cron_env is defined and comanage_cron_jobs is defined and comanage_cron_jobs_enabled

- name: Ensure COmanage Registry cron jobs are installed
cron:
name: "{{ item.name }}"
Expand Down

0 comments on commit 7663ee0

Please sign in to comment.