added pki state

This commit is contained in:
Paul 2020-11-30 21:44:50 +01:00
parent 0a6c9fcd37
commit e753afd5e1
6 changed files with 66 additions and 0 deletions

9
states/pki/defaults.yaml Normal file
View File

@ -0,0 +1,9 @@
---
pki:
enabled: true
install_dir: /usr/local/apps
release_dir: /usr/local/apps/releases
mirror: https://git.paulbsd.com/paulbsd/pki/releases/download
version: 0.1.0
os: linux
arch: amd64

3
states/pki/init.sls Normal file
View File

@ -0,0 +1,3 @@
---
include:
- .install

16
states/pki/install.sls Normal file
View File

@ -0,0 +1,16 @@
---
{% from "pki/map.jinja" import pki with context %}
pki-archive-extract:
archive.extracted:
- name: {{ pki.release_dir }}/pki-{{ pki.version }}
- source: {{ pki.mirror }}/{{ pki.version }}/pki-{{ pki.version }}-{{ pki.os }}-{{ pki.arch }}.tar.gz
- skip_verify: true
- enforce_toplevel: false
- if_missing: {{ pki.release_dir }}/pki-{{ pki.version }}
pki-binary-symlink:
file.symlink:
- name: {{ pki.install_dir }}/pki
- target: {{ pki.release_dir }}/pki-{{ pki.version }}
- require:
- archive: pki-archive-extract

View File

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

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

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

21
states/pki/osarchmap.yaml Normal file
View File

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