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