Skip to content

Commit 59b66f0

Browse files
authored
Merge pull request #12 from SynPrime/master
feat(cron.env): add env option in cron-formula
2 parents f9c61a9 + 12cee12 commit 59b66f0

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

cron/config/file.sls

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,16 @@ cron.{{ task }}:
2323
{%- endif %}
2424
2525
{%- endfor %}
26+
27+
{%- for env, env_options in cron.get('env', {}). items() %}
28+
{%- set env_type = env_options.type|d('present') %}
29+
30+
cron.{{ env }}:
31+
cron.env_{{ env_type }}:
32+
- name: {{ env_options.name }}
33+
{%- if env_type == 'present' %}
34+
- value: {{ env_options.value }}
35+
{%- endif %}
36+
- user: {{ env_options.user|d('root') }}
37+
38+
{%- endfor %}

pillar.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,19 @@ cron:
3535
minute: '*/5'
3636
hour: '*'
3737
comment: comment4
38+
env:
39+
env1:
40+
type: present # Default
41+
name: PATH
42+
value: /usr/local/bin:/usr/bin:/bin:/usr/games
43+
user: root # Default
44+
env2:
45+
type: absent
46+
name: MAILTO
47+
value: [email protected] # not needed
48+
user: root # Default
49+
env3:
50+
type: absent
51+
name: LANG
52+
value: en_GB.UTF-8
53+
user: root

0 commit comments

Comments
 (0)