updated lego state

This commit is contained in:
Paul 2020-10-01 23:06:47 +02:00
parent be4f389ee6
commit 74fcae4162
6 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,9 @@
---
lego:
enabled: true
install_dir: /usr/local/apps
release_dir: /usr/local/apps/releases
mirror: https://github.com/go-acme/lego/releases/download
version: v4.0.1
os: linux
arch: amd64

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

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

19
states/lego/install.sls Normal file
View File

@ -0,0 +1,19 @@
---
{%- from "lego/map.jinja" import lego with context %}
{%- if not salt['file.file_exists']( lego.install_dir +"/lego-" + lego.version) %}
lego-archive-extract:
archive.extracted:
- name: {{ lego.release_dir }}/lego-{{ lego.version }}-{{ lego.os }}-{{ lego.arch }}
- source: {{ lego.mirror }}/{{ lego.version }}/lego_{{ lego.version }}_{{ lego.os }}_{{ lego.arch }}.tar.gz
- skip_verify: true
- enforce_toplevel: false
- if_missing: {{ lego.release_dir }}/lego-{{ lego.version }}-{{ lego.os }}-{{ lego.arch }}
lego-binary-symlink:
file.symlink:
- name: /usr/local/bin/lego
- target: {{ lego.release_dir }}/lego-{{ lego.version }}-{{ lego.os }}-{{ lego.arch }}/lego
- force: true
- require:
- archive: lego-archive-extract
{%- endif %}

View File

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

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

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

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"