added systemd state
This commit is contained in:
parent
f02e2563ca
commit
6e410e9123
12
states/systemd/defaults.yaml
Normal file
12
states/systemd/defaults.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
systemd:
|
||||||
|
confdir: /etc/systemd
|
||||||
|
config:
|
||||||
|
journald:
|
||||||
|
Journal:
|
||||||
|
Storage: auto
|
||||||
|
Compress: "yes"
|
||||||
|
SystemMaxUse: 500M
|
||||||
|
networkd:
|
||||||
|
Network:
|
||||||
|
SpeedMeter: "yes"
|
24
states/systemd/init.sls
Normal file
24
states/systemd/init.sls
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
{%- from "systemd/map.jinja" import systemd with context %}
|
||||||
|
{% for module,settings in systemd.config.items() %}
|
||||||
|
systemd-confdir-{{ module }}:
|
||||||
|
file.directory:
|
||||||
|
- name: {{ systemd.confdir }}/{{ module }}.conf.d/
|
||||||
|
|
||||||
|
systemd-configfile-{{ module }}:
|
||||||
|
file.managed:
|
||||||
|
- name: {{ systemd.confdir }}/{{ module }}.conf.d/custom.conf
|
||||||
|
- source: salt://systemd/templates/systemd_custom.conf.j2
|
||||||
|
- template: jinja
|
||||||
|
- user: root
|
||||||
|
- group: root
|
||||||
|
- mode: 0644
|
||||||
|
- context:
|
||||||
|
settings: {{ settings }}
|
||||||
|
|
||||||
|
systemd-service-{{ module }}:
|
||||||
|
service.running:
|
||||||
|
- name: systemd-{{ module }}
|
||||||
|
- watch:
|
||||||
|
- file: systemd-configfile-{{ module }}
|
||||||
|
{% endfor %}
|
3
states/systemd/kernelmap.yaml
Normal file
3
states/systemd/kernelmap.yaml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
Linux:
|
||||||
|
os: "linux"
|
14
states/systemd/map.jinja
Normal file
14
states/systemd/map.jinja
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{%- import_yaml "systemd/defaults.yaml" as default_settings -%}
|
||||||
|
|
||||||
|
{%- import_yaml "systemd/kernelmap.yaml" as kernelmap %}
|
||||||
|
{%- import_yaml "systemd/osarchmap.yaml" as osarchmap %}
|
||||||
|
|
||||||
|
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||||
|
default='systemd',
|
||||||
|
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||||
|
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
-%}
|
||||||
|
|
||||||
|
{%- set systemd = salt['pillar.get']('systemd', default=defaults, merge=True) -%}
|
24
states/systemd/osarchmap.yaml
Normal file
24
states/systemd/osarchmap.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
amd64:
|
||||||
|
arch: "amd64"
|
||||||
|
|
||||||
|
x86_64:
|
||||||
|
arch: "amd64"
|
||||||
|
|
||||||
|
386:
|
||||||
|
arch: "386"
|
||||||
|
|
||||||
|
arm64:
|
||||||
|
arch: "arm64"
|
||||||
|
|
||||||
|
aarch64:
|
||||||
|
arch: "arm64"
|
||||||
|
|
||||||
|
armv6l:
|
||||||
|
arch: "arm"
|
||||||
|
|
||||||
|
armv7l:
|
||||||
|
arch: "arm"
|
||||||
|
|
||||||
|
armhf:
|
||||||
|
arch: "arm"
|
6
states/systemd/templates/systemd_custom.conf.j2
Normal file
6
states/systemd/templates/systemd_custom.conf.j2
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{% for module, setting in settings.items() -%}
|
||||||
|
[{{ module }}]
|
||||||
|
{%- for key, value in setting.items() %}
|
||||||
|
{{ key }}={{ value }}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endfor %}
|
Loading…
Reference in New Issue
Block a user