updated dkron and misc on states/modules

This commit is contained in:
Paul 2020-11-30 22:29:10 +01:00
parent b2ec2328a8
commit 696aed5ea2
6 changed files with 6 additions and 9 deletions

0
states/_modules/custom.py Executable file → Normal file
View File

0
states/_states/custom.py Executable file → Normal file
View File

View File

@ -4,16 +4,13 @@ from __future__ import absolute_import, print_function, unicode_literals
import salt.utils.dictupdate import salt.utils.dictupdate
import salt.utils.dictdiffer import salt.utils.dictdiffer
def jobs(name, url="http://localhost:8080", verify=False, jobs=[]): def jobs(name, url="http://localhost:8080", verify=False, jobs_list=[]):
ret = {'name': name, ret = {'name': name,
'changes': {}, 'changes': {},
'result': True, 'result': True,
'comment': 'Config is up to date'} 'comment': 'Config is up to date'}
#dk_jobs = [] for job in jobs_list:
#dk_jobs = __salt__['dkron.get_jobs'](url, verify)
for job in jobs:
res = __salt__['dkron.set_jobs'](url, verify, job) res = __salt__['dkron.set_jobs'](url, verify, job)
if res is not None: if res is not None:
ret['changes'][job['name']] = res ret['changes'][job['name']] = res

View File

@ -1,5 +1,5 @@
--- ---
{%- from "dkron/map.jinja" import dkron with context -%} {%- from "dkron/map.jinja" import dkron with context %}
dkron-config-dir: dkron-config-dir:
file.directory: file.directory:
- name: /etc/dkron - name: /etc/dkron
@ -12,4 +12,4 @@ dkron-config:
- user: {{ dkron.runuser }} - user: {{ dkron.runuser }}
- template: jinja - template: jinja
- watch_in: - watch_in:
- service: dkron-service - service: dkron-service

View File

@ -17,4 +17,4 @@ dkron:
server: true server: true
http-addr: "127.0.0.1:8898" http-addr: "127.0.0.1:8898"
data-dir: "/var/lib/dkron" data-dir: "/var/lib/dkron"
jobs: [] jobs_list: []

View File

@ -5,4 +5,4 @@ dkron-jobs:
- name: dkron-jobs - name: dkron-jobs
- url: {{ dkron.url }} - url: {{ dkron.url }}
- verify: {{ dkron.verify }} - verify: {{ dkron.verify }}
- job_list: {{ dkron.jobs }} - jobs_list: {{ dkron.jobs_list }}