diff --git a/states/borg/defaults.yaml b/states/borg/defaults.yaml new file mode 100644 index 0000000..4af31f9 --- /dev/null +++ b/states/borg/defaults.yaml @@ -0,0 +1,8 @@ +--- +borg: + enabled: true + working_dir: /opt/borg + pip_pkgs: + - llfuse + - borgbackup + jobs: {} diff --git a/states/borg/init.sls b/states/borg/init.sls new file mode 100644 index 0000000..691a493 --- /dev/null +++ b/states/borg/init.sls @@ -0,0 +1,6 @@ +--- +include: + - .pkgs + - .install + #- .config + #- .schedule diff --git a/states/borg/install.sls b/states/borg/install.sls new file mode 100644 index 0000000..479b7bb --- /dev/null +++ b/states/borg/install.sls @@ -0,0 +1,11 @@ +--- +{%- from "borg/map.jinja" import borg with context %} +borg-working-dir: + file.directory: + - name: {{ borg.working_dir }} + +{% for dir in ['bin', 'logs', 'scripts'] %} +borg-working-dir-{{ dir }}: + file.directory: + - name: {{ borg.working_dir }}/{{ dir }} +{% endfor %} diff --git a/states/borg/map.jinja b/states/borg/map.jinja new file mode 100644 index 0000000..524d545 --- /dev/null +++ b/states/borg/map.jinja @@ -0,0 +1,8 @@ +{%- import_yaml "borg/defaults.yaml" as defaults -%} + +{%- set borg = salt['pillar.get']( + 'borg', + default=defaults.borg, + merge=True + ) +-%} diff --git a/states/borg/pkgs.sls b/states/borg/pkgs.sls new file mode 100644 index 0000000..32f0b64 --- /dev/null +++ b/states/borg/pkgs.sls @@ -0,0 +1,8 @@ +--- +{%- from "borg/map.jinja" import borg with context %} + +{%- for pkg in borg.pip_pkgs %} +borg-pkg-reqs-{{ pkg }}: + pip.installed: + - name: {{ pkg }} +{%- endfor %}