remove the curator cronjobs if it is disabled

This commit is contained in:
m0duspwnens
2021-08-20 10:40:15 -04:00
parent 43ffaab82c
commit 6f9a263af3

View File

@@ -4,6 +4,7 @@
{% set VERSION = salt['pillar.get']('global:soversion', 'HH1.2.2') %} {% set VERSION = salt['pillar.get']('global:soversion', 'HH1.2.2') %}
{% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %} {% set IMAGEREPO = salt['pillar.get']('global:imagerepo') %}
{% set MANAGER = salt['grains.get']('master') %} {% set MANAGER = salt['grains.get']('master') %}
{% set REMOVECURATORCRON = False %}
{% if grains['role'] in ['so-eval', 'so-node', 'so-managersearch', 'so-heavynode', 'so-standalone', 'so-manager'] %} {% if grains['role'] in ['so-eval', 'so-node', 'so-managersearch', 'so-heavynode', 'so-standalone', 'so-manager'] %}
{% from 'elasticsearch/auth.map.jinja' import ELASTICAUTH with context %} {% from 'elasticsearch/auth.map.jinja' import ELASTICAUTH with context %}
{% from "curator/map.jinja" import CURATOROPTIONS with context %} {% from "curator/map.jinja" import CURATOROPTIONS with context %}
@@ -88,36 +89,6 @@ curdel:
- group: 939 - group: 939
- mode: 755 - mode: 755
so-curatorcloseddeletecron:
cron.present:
- name: /usr/sbin/so-curator-closed-delete > /opt/so/log/curator/cron-closed-delete.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
so-curatorclosecron:
cron.present:
- name: /usr/sbin/so-curator-close > /opt/so/log/curator/cron-close.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
so-curatordeletecron:
cron.present:
- name: /usr/sbin/so-curator-delete > /opt/so/log/curator/cron-delete.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
so-curator: so-curator:
docker_container.{{ CURATOROPTIONS.status }}: docker_container.{{ CURATOROPTIONS.status }}:
{% if CURATOROPTIONS.status == 'running' %} {% if CURATOROPTIONS.status == 'running' %}
@@ -152,11 +123,15 @@ so-curator_so-status.disabled:
file.comment: file.comment:
- name: /opt/so/conf/so-status/so-status.conf - name: /opt/so/conf/so-status/so-status.conf
- regex: ^so-curator$ - regex: ^so-curator$
# need to remove cronjobs here since curator is disabled
{% set REMOVECURATORCRON = True %}
{% else %} {% else %}
delete_so-curator_so-status.disabled: delete_so-curator_so-status.disabled:
file.uncomment: file.uncomment:
- name: /opt/so/conf/so-status/so-status.conf - name: /opt/so/conf/so-status/so-status.conf
- regex: ^so-curator$ - regex: ^so-curator$
{% endif %} {% endif %}
{% else %} {% else %}
@@ -165,6 +140,60 @@ delete_so-curator_so-status:
- name: /opt/so/conf/so-status/so-status.conf - name: /opt/so/conf/so-status/so-status.conf
- match: ^so-curator$ - match: ^so-curator$
- mode: delete - mode: delete
# need to remove cronjobs here since curator is disabled
{% set REMOVECURATORCRON = True %}
{% endif %}
{% if REMOVECURATORCRON %}
so-curatorcloseddeletecron:
cron.absent:
- name: /usr/sbin/so-curator-closed-delete > /opt/so/log/curator/cron-closed-delete.log 2>&1
- user: root
so-curatorclosecron:
cron.absent:
- name: /usr/sbin/so-curator-close > /opt/so/log/curator/cron-close.log 2>&1
- user: root
so-curatordeletecron:
cron.absent:
- name: /usr/sbin/so-curator-delete > /opt/so/log/curator/cron-delete.log 2>&1
- user: root
{% else %}
so-curatorcloseddeletecron:
cron.present:
- name: /usr/sbin/so-curator-closed-delete > /opt/so/log/curator/cron-closed-delete.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
so-curatorclosecron:
cron.present:
- name: /usr/sbin/so-curator-close > /opt/so/log/curator/cron-close.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
so-curatordeletecron:
cron.present:
- name: /usr/sbin/so-curator-delete > /opt/so/log/curator/cron-delete.log 2>&1
- user: root
- minute: '*'
- hour: '*'
- daymonth: '*'
- month: '*'
- dayweek: '*'
{% endif %} {% endif %}
# Begin Curator Cron Jobs # Begin Curator Cron Jobs