paulbsd-salt/states/kopia/config.sls
Paul Lecuq 74584c5a2b
All checks were successful
continuous-integration/drone/push Build is passing
updated kopia state
2023-12-04 22:33:51 +01:00

61 lines
1.3 KiB
Plaintext

---
{%- from "kopia/map.jinja" import kopia with context %}
kopia-config-dir:
file.directory:
- name: /etc/kopia
- user: root
- group: root
- mode: 700
kopia-config-sudo:
file.managed:
- name: /etc/sudoers.d/kopia
- source: salt://kopia/templates/kopia_sudo.j2
- template: jinja
- user: root
- group: root
- mode: 600
- check_cmd: /usr/sbin/visudo -c -f
{% for name, params in kopia.jobs.items() %}
kopia-config-{{ name }}:
file.directory:
- name: /etc/kopia/{{ name }}
- user: root
- group: root
- mode: 700
- require:
- file: kopia-config-dir
kopia-config-{{ name }}-run:
file.managed:
- name: /etc/kopia/{{ name }}/backup.py
- source: salt://kopia/templates/kopia_backup.py.j2
- user: root
- group: root
- mode: 700
- template: jinja
- context:
name: {{ name }}
params: {{ params }}
- require:
- file: kopia-config-dir
- file: kopia-config-{{ name }}
{% for dir in params.dirs %}
{% if "ignore" in dir.keys() %}
kopia-config-{{ name }}-{{ dir.path }}-ignore:
file.managed:
- name: {{ dir.path }}/.kopiaignore
- source: salt://kopia/templates/kopiaignore.j2
- user: root
- group: root
- mode: 700
- template: jinja
- context:
ignore: {{ dir.ignore }}
{% endif %}
{% endfor %}
{% endfor %}