From 7b7d96eac5cd321dfd21652434d6ba21bb566c9a Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sun, 19 Feb 2023 12:21:44 +0100 Subject: [PATCH] updated provision state --- states/provision/defaults.yaml | 4 ++-- states/provision/grains.sls | 9 +++++++++ states/provision/init.sls | 26 +++----------------------- states/provision/schedule.sls | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 states/provision/grains.sls create mode 100644 states/provision/schedule.sls diff --git a/states/provision/defaults.yaml b/states/provision/defaults.yaml index bee7eff..342f65d 100644 --- a/states/provision/defaults.yaml +++ b/states/provision/defaults.yaml @@ -11,5 +11,5 @@ specs: lb: false provision: - highstate_interval: 30 - clear_cache_interval: 7 + highstate_interval_minutes: 20 + clear_cache_interval_days: 30 diff --git a/states/provision/grains.sls b/states/provision/grains.sls new file mode 100644 index 0000000..b895671 --- /dev/null +++ b/states/provision/grains.sls @@ -0,0 +1,9 @@ +--- +{%- from "provision/map.jinja" import specs with context %} +{% for key, value in specs.items() %} +grains-{{ key }}: + grains.present: + - name: {{ key }} + - value: {{ value }} + - force: true +{% endfor %} diff --git a/states/provision/init.sls b/states/provision/init.sls index f6248ed..210129d 100644 --- a/states/provision/init.sls +++ b/states/provision/init.sls @@ -1,24 +1,4 @@ --- -{%- from "provision/map.jinja" import provision with context %} -{%- from "provision/map.jinja" import specs with context %} -schedule_highstate: - schedule.present: - - name: schedule_highstate - - function: state.highstate - - minutes: {{ provision.highstate_interval }} - - run_on_start: false - -schedule_saltutil_clear_cache: - schedule.present: - - name: schedule_saltutil_clear_cache - - function: saltutil.clear_cache - - days: {{ provision.clear_cache_interval }} - - run_on_start: false - -{% for key, value in specs.items() %} -grains-{{ key }}: - grains.present: - - name: {{ key }} - - value: {{ value }} - - force: true -{% endfor %} +include: + - .schedule + - .grains diff --git a/states/provision/schedule.sls b/states/provision/schedule.sls new file mode 100644 index 0000000..a57457d --- /dev/null +++ b/states/provision/schedule.sls @@ -0,0 +1,15 @@ +--- +{%- from "provision/map.jinja" import provision with context %} +schedule_highstate: + schedule.present: + - name: schedule_highstate + - function: state.highstate + - minutes: {{ provision.highstate_interval_minutes }} + - run_on_start: false + +schedule_saltutil_clear_cache: + schedule.absent: + - name: schedule_saltutil_clear_cache + - function: saltutil.clear_cache + - days: {{ provision.clear_cache_interval_days }} + - run_on_start: false