diff --git a/states/pki/defaults.yaml b/states/pki/defaults.yaml new file mode 100644 index 0000000..752da7e --- /dev/null +++ b/states/pki/defaults.yaml @@ -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 diff --git a/states/pki/init.sls b/states/pki/init.sls new file mode 100644 index 0000000..10ad9a6 --- /dev/null +++ b/states/pki/init.sls @@ -0,0 +1,3 @@ +--- +include: + - .install \ No newline at end of file diff --git a/states/pki/install.sls b/states/pki/install.sls new file mode 100644 index 0000000..b76d05d --- /dev/null +++ b/states/pki/install.sls @@ -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 diff --git a/states/pki/kernelmap.yaml b/states/pki/kernelmap.yaml new file mode 100644 index 0000000..e368b24 --- /dev/null +++ b/states/pki/kernelmap.yaml @@ -0,0 +1,3 @@ +--- +Linux: + os: "linux" \ No newline at end of file diff --git a/states/pki/map.jinja b/states/pki/map.jinja new file mode 100644 index 0000000..a1ba258 --- /dev/null +++ b/states/pki/map.jinja @@ -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) -%} diff --git a/states/pki/osarchmap.yaml b/states/pki/osarchmap.yaml new file mode 100644 index 0000000..c12e349 --- /dev/null +++ b/states/pki/osarchmap.yaml @@ -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" \ No newline at end of file