added gobackup state

This commit is contained in:
Paul 2020-08-30 16:54:26 +02:00
parent e74f591f6f
commit be5cb6fcf0
8 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,11 @@
---
{%- from "gobackup/map.jinja" import gobackup with context %}
gobackup-config-dir:
file.directory:
- name: {{ gobackup.config_dir }}
gobackup-config-file:
file.managed:
- name: {{ gobackup.config_dir }}/gobackup.yml
- source: salt://gobackup/templates/gobackup.yml.j2
- template: jinja

View File

@ -0,0 +1,15 @@
---
gobackup:
enabled: true
fetch_url: https://paulbsd-pub.s3.fr-par.scw.cloud/gobackup
install_dir: /usr/local/bin
config_dir: /etc/gobackup
config:
user: gobackup
password: password
store:
type: local
keep: 3
path: /var/lib/gobackup
compress:
type: tgz

4
states/gobackup/init.sls Normal file
View File

@ -0,0 +1,4 @@
---
include:
- .install
- .config

View File

@ -0,0 +1,10 @@
---
{%- from "gobackup/map.jinja" import gobackup with context %}
gobackup-bin:
file.managed:
- name: {{ gobackup.install_dir }}/gobackup
- source: {{ gobackup.fetch_url }}/gobackup-{{ gobackup.os }}-{{ gobackup.arch }}
- user: root
- group: root
- skip_verify: True
- if_missing: {{ gobackup.install_dir }}/gobackup

View File

@ -0,0 +1,3 @@
---
Linux:
os: linux

14
states/gobackup/map.jinja Normal file
View File

@ -0,0 +1,14 @@
{%- import_yaml "gobackup/defaults.yaml" as default_settings -%}
{%- set defaults = salt['grains.filter_by'](default_settings, default='gobackup') -%}
{%- import_yaml "gobackup/kernelmap.yaml" as kernelmap %}
{%- import_yaml "gobackup/osarchmap.yaml" as osarchmap %}
{%- set gobackup = salt['pillar.get']('gobackup',
default=defaults,
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
)
)
-%}

View File

@ -0,0 +1,21 @@
---
amd64:
arch: amd64
arm64:
arch: arm64
# 386:
# arch: 386
# arm64:
# arch: arm64
# armv6l:
# arch: arm
# armv7l:
# arch: arm
# armhf:
# arch: arm