updated kopia state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-11-24 19:34:47 +01:00
parent ed3aa290e9
commit f191d2bead
7 changed files with 113 additions and 0 deletions

21
states/kopia/config.sls Normal file
View File

@ -0,0 +1,21 @@
---
{%- from "kopia/map.jinja" import kopia with context %}
kopia-config-dir:
file.directory:
- name: /etc/kopia
- user: root
- group: root
- mode: 700
- watch_in:
- service: kopia-service
kopia-config-file:
file.managed:
- name: /etc/kopia/kopia.conf
- source: salt://kopia/templates/kopia.conf.j2
- user: root
- group: root
- mode: 600
- template: jinja
- watch_in:
- service: kopia-service

View File

@ -0,0 +1,9 @@
---
kopia:
enabled: true
release_dir: /usr/local/apps/releases
install_dir: /usr/local/apps
mirror: https://github.com/kopia/kopia/releases/download
version: 0.15.0
os: linux
arch: x64

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

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

38
states/kopia/install.sls Normal file
View File

@ -0,0 +1,38 @@
---
{%- from "kopia/map.jinja" import kopia with context %}
{% set archive_exclude_dir = './kopia-' + kopia.version + '-' + kopia.os + '-' + kopia.arch %}
kopia-archive-extract:
archive.extracted:
- name: {{ kopia.release_dir }}/kopia-{{ kopia.version }}
- source: {{ kopia.mirror }}/v{{ kopia.version }}/kopia-{{ kopia.version }}-{{ kopia.os }}-{{ kopia.arch }}.tar.gz
- enforce_toplevel: false
- options: >
--transform 's|^\{{ archive_exclude_dir }}|/|g'
--transform 's|LICENSE||g'
--transform 's|README.md||g'
--strip 1
- skip_verify: true
- archive_format: tar
- if_missing: {{ kopia.release_dir }}/kopia-{{ kopia.version }}/kopia
kopia-bin-perm:
file.managed:
- name: {{ kopia.release_dir }}/kopia-{{ kopia.version }}/kopia
- user: root
- group: root
- require:
- archive: kopia-archive-extract
kopia-bin-symlink:
file.symlink:
- name: /usr/local/bin/kopia
- target: {{ kopia.release_dir }}/kopia-{{ kopia.version }}/kopia
- force: true
- require:
- archive: kopia-archive-extract
kopia-cleanup:
software.cleanup:
- name: kopia
- path: {{ kopia.release_dir }}
- version: "{{ kopia.version }}"

View File

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

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

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

View File

@ -0,0 +1,24 @@
---
amd64:
arch: "x64"
x86_64:
arch: "x64"
386:
arch: "386"
arm64:
arch: "arm64"
aarch64:
arch: "arm64"
armv6l:
arch: "arm"
armv7l:
arch: "arm"
armhf:
arch: "arm"