added iplbc state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2023-01-07 21:04:49 +01:00
parent 5440508ca4
commit 9730b83e41
8 changed files with 107 additions and 0 deletions

View File

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

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

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

30
states/ipblc/install.sls Normal file
View File

@ -0,0 +1,30 @@
---
{%- from "ipblc/map.jinja" import ipblc with context %}
ipblc-dependencies:
pkg.installed:
- name: libczmq4
ipblc-archive-extract:
archive.extracted:
- name: {{ ipblc.release_dir }}/ipblc-{{ ipblc.version }}
- source: {{ ipblc.mirror }}/{{ ipblc.version }}/ipblc-{{ ipblc.version }}-{{ ipblc.os }}-{{ ipblc.arch }}.tar.gz
- skip_verify: true
- enforce_toplevel: false
- if_missing: {{ ipblc.release_dir }}/ipblc-{{ ipblc.version }}
- watch_in:
- service: ipblc-service
ipblc-binary-symlink:
file.symlink:
- name: {{ ipblc.install_dir }}/ipblc
- target: {{ ipblc.release_dir }}/ipblc-{{ ipblc.version }}
- require:
- archive: ipblc-archive-extract
- watch_in:
- service: ipblc-service
ipblc-cleanup:
software.cleanup:
- name: ipblc
- path: {{ ipblc.release_dir }}
- version: "{{ ipblc.version }}"

View File

@ -0,0 +1,12 @@
{%- from "ipblc/map.jinja" import ipblc with context -%}
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
[Unit]
Description=ipblc
After=network.target postgresql.service
[Service]
Type=simple
ExecStart={{ ipblc.install_dir }}/ipblc/ipblc
[Install]
WantedBy=multi-user.target

View File

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

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

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

14
states/ipblc/service.sls Normal file
View File

@ -0,0 +1,14 @@
---
{%- from "ipblc/map.jinja" import ipblc with context %}
ipblc-service-file:
file.managed:
- name: /etc/systemd/system/ipblc.service
- source: salt://ipblc/ipblc.service.j2
- user: root
- group: root
- template: jinja
ipblc-service:
service.running:
- name: ipblc
- enable: true