added go-aptproxy state
This commit is contained in:
parent
ddae2b2ac8
commit
07ebd0facd
11
states/go-aptproxy/defaults.yaml
Normal file
11
states/go-aptproxy/defaults.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
go-aptproxy:
|
||||
enabled: true
|
||||
install_dir: /usr/local/apps
|
||||
release_dir: /usr/local/apps/releases
|
||||
working_dir: /var/cache/go-aptproxy
|
||||
port: 8000
|
||||
mirror: https://git.paulbsd.com/paulbsd/go-aptproxy/releases/download
|
||||
version: 1.0.0
|
||||
os: linux
|
||||
arch: amd64
|
4
states/go-aptproxy/init.sls
Normal file
4
states/go-aptproxy/init.sls
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
include:
|
||||
- .install
|
||||
- .service
|
26
states/go-aptproxy/install.sls
Normal file
26
states/go-aptproxy/install.sls
Normal file
@ -0,0 +1,26 @@
|
||||
---
|
||||
{%- from "go-aptproxy/map.jinja" import go-aptproxy with context %}
|
||||
go-aptproxy-archive-extract:
|
||||
archive.extracted:
|
||||
- name: {{ go-aptproxy.release_dir }}/go-aptproxy-{{ go-aptproxy.version }}
|
||||
- source: {{ go-aptproxy.mirror }}/{{ go-aptproxy.version }}/go-aptproxy-{{ go-aptproxy.version }}-{{ go-aptproxy.os }}-{{ go-aptproxy.arch }}.tar.gz
|
||||
- skip_verify: true
|
||||
- enforce_toplevel: false
|
||||
- if_missing: {{ go-aptproxy.release_dir }}/go-aptproxy-{{ go-aptproxy.version }}
|
||||
- watch_in:
|
||||
- service: go-aptproxy-service
|
||||
|
||||
go-aptproxy-binary-symlink:
|
||||
file.symlink:
|
||||
- name: {{ go-aptproxy.install_dir }}/go-aptproxy
|
||||
- target: {{ go-aptproxy.release_dir }}/go-aptproxy-{{ go-aptproxy.version }}
|
||||
- require:
|
||||
- archive: go-aptproxy-archive-extract
|
||||
- watch_in:
|
||||
- service: go-aptproxy-service
|
||||
|
||||
go-aptproxy-cleanup:
|
||||
software.cleanup:
|
||||
- name: go-aptproxy
|
||||
- path: {{ go-aptproxy.release_dir }}
|
||||
- version: {{ go-aptproxy.version }}
|
3
states/go-aptproxy/kernelmap.yaml
Normal file
3
states/go-aptproxy/kernelmap.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
Linux:
|
||||
os: "linux"
|
14
states/go-aptproxy/map.jinja
Normal file
14
states/go-aptproxy/map.jinja
Normal file
@ -0,0 +1,14 @@
|
||||
{%- import_yaml "go-aptproxy/defaults.yaml" as default_settings -%}
|
||||
|
||||
{%- import_yaml "go-aptproxy/kernelmap.yaml" as kernelmap -%}
|
||||
{%- import_yaml "go-aptproxy/osarchmap.yaml" as osarchmap -%}
|
||||
|
||||
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||
default='go-aptproxy',
|
||||
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
|
||||
)
|
||||
)
|
||||
-%}
|
||||
|
||||
{%- set go-aptproxy = salt['pillar.get']('go-aptproxy', default=defaults, merge=True) -%}
|
21
states/go-aptproxy/osarchmap.yaml
Normal file
21
states/go-aptproxy/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"
|
17
states/go-aptproxy/qrz.service.j2
Normal file
17
states/go-aptproxy/qrz.service.j2
Normal file
@ -0,0 +1,17 @@
|
||||
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
|
||||
{%- from "go-aptproxy/map.jinja" import go-aptproxy with context %}
|
||||
[Unit]
|
||||
Description=go-aptproxy
|
||||
Documentation=https://git.paulbsd.com/paulbsd/go-aptproxy
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart={{ go-aptproxy.install_dir }}/go-aptproxy/go-aptproxy -directory {{ go-aptproxy.working_dir }} -port {{ go-aptproxy.port }}
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
RestartForceExitStatus=SIGPIPE
|
||||
KillMode=control-group
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
14
states/go-aptproxy/service.sls
Normal file
14
states/go-aptproxy/service.sls
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
{%- from "go-aptproxy/map.jinja" import go-aptproxy with context %}
|
||||
go-aptproxy-service-file:
|
||||
file.managed:
|
||||
- name: /etc/systemd/system/go-aptproxy.service
|
||||
- source: salt://go-aptproxy/go-aptproxy.service.j2
|
||||
- user: root
|
||||
- group: root
|
||||
- template: jinja
|
||||
|
||||
go-aptproxy-service:
|
||||
service.running:
|
||||
- name: go-aptproxy
|
||||
- enable: true
|
Loading…
Reference in New Issue
Block a user