added ipbl state
This commit is contained in:
parent
782b0afe7d
commit
5460385b99
10
states/ipbl/defaults.yaml
Normal file
10
states/ipbl/defaults.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
ipbl:
|
||||
enabled: true
|
||||
install_dir: /usr/local/apps
|
||||
release_dir: /usr/local/apps/releases
|
||||
port: 8099
|
||||
mirror: https://git.paulbsd.com/paulbsd/ipbl/releases/download
|
||||
version: "1.0.0"
|
||||
os: linux
|
||||
arch: amd64
|
4
states/ipbl/init.sls
Normal file
4
states/ipbl/init.sls
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
include:
|
||||
- .install
|
||||
- .service
|
26
states/ipbl/install.sls
Normal file
26
states/ipbl/install.sls
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
{%- from "ipbl/map.jinja" import ipbl with context %}
|
||||
ipbl-archive-extract:
|
||||
archive.extracted:
|
||||
- name: {{ ipbl.release_dir }}/ipbl-{{ ipbl.version }}
|
||||
- source: {{ ipbl.mirror }}/{{ ipbl.version }}/ipbl-{{ ipbl.version }}-{{ ipbl.os }}-{{ ipbl.arch }}.tar.gz
|
||||
- skip_verify: true
|
||||
- enforce_toplevel: false
|
||||
- if_missing: {{ ipbl.release_dir }}/ipbl-{{ ipbl.version }}
|
||||
- watch_in:
|
||||
- service: ipbl-service
|
||||
|
||||
ipbl-binary-symlink:
|
||||
file.symlink:
|
||||
- name: {{ ipbl.install_dir }}/ipbl
|
||||
- target: {{ ipbl.release_dir }}/ipbl-{{ ipbl.version }}
|
||||
- require:
|
||||
- archive: ipbl-archive-extract
|
||||
- watch_in:
|
||||
- service: ipbl-service
|
||||
|
||||
ipbl-cleanup:
|
||||
software.cleanup:
|
||||
- name: ipbl
|
||||
- path: {{ ipbl.release_dir }}
|
||||
- version: {{ ipbl.version }}
|
12
states/ipbl/ipbl.service.j2
Normal file
12
states/ipbl/ipbl.service.j2
Normal file
@ -0,0 +1,12 @@
|
||||
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
|
||||
{%- from "ipbl/map.jinja" import ipbl with context %}
|
||||
[Unit]
|
||||
Description=ipbl
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart={{ ipbl.install_dir }}/ipbl/ipbl -configfile {{ ipbl.install_dir }}/config/common.ini -port {{ ipbl.port }}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
3
states/ipbl/kernelmap.yaml
Normal file
3
states/ipbl/kernelmap.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
Linux:
|
||||
os: "linux"
|
14
states/ipbl/map.jinja
Normal file
14
states/ipbl/map.jinja
Normal file
@ -0,0 +1,14 @@
|
||||
{%- import_yaml "ipbl/defaults.yaml" as default_settings -%}
|
||||
|
||||
{%- import_yaml "ipbl/kernelmap.yaml" as kernelmap -%}
|
||||
{%- import_yaml "ipbl/osarchmap.yaml" as osarchmap -%}
|
||||
|
||||
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||
default='ipbl',
|
||||
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
|
||||
)
|
||||
)
|
||||
-%}
|
||||
|
||||
{%- set ipbl = salt['pillar.get']('ipbl', default=defaults, merge=True) -%}
|
21
states/ipbl/osarchmap.yaml
Normal file
21
states/ipbl/osarchmap.yaml
Normal 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/ipbl/service.sls
Normal file
14
states/ipbl/service.sls
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
{%- from "ipbl/map.jinja" import ipbl with context %}
|
||||
ipbl-service-file:
|
||||
file.managed:
|
||||
- name: /etc/systemd/system/ipbl.service
|
||||
- source: salt://ipbl/ipbl.service.j2
|
||||
- user: root
|
||||
- group: root
|
||||
- template: jinja
|
||||
|
||||
ipbl-service:
|
||||
service.running:
|
||||
- name: ipbl
|
||||
- enable: true
|
Loading…
Reference in New Issue
Block a user