Added sleep state
This commit is contained in:
parent
9deffb5713
commit
8a873b3b21
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
||||
Copyright (c) <year> <owner>
|
||||
Copyright (c) 2023 Gregory Ballantine
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
2
system/defaults.yaml
Normal file
2
system/defaults.yaml
Normal file
@ -0,0 +1,2 @@
|
||||
sleep:
|
||||
disable: True
|
29
system/map.jinja
Normal file
29
system/map.jinja
Normal file
@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=jinja ts=2 sw=2 expandtab
|
||||
|
||||
{## Start with defaults from defaults.sls ##}
|
||||
{% import_yaml 'system/defaults.yaml' as default_settings %}
|
||||
|
||||
{##
|
||||
Setup variable using grains['os_family'] based logic, only add key:values here
|
||||
that differ from whats in defaults.yaml
|
||||
##}
|
||||
{% set flavor_map = salt['grains.filter_by'](
|
||||
{
|
||||
'Debian': {},
|
||||
'FreeBSD': {},
|
||||
'RedHat': {}
|
||||
},
|
||||
grain='os_family',
|
||||
merge=salt['pillar.get']('system')
|
||||
) %}
|
||||
|
||||
{## Merge the flavor_map over the default settings ##}
|
||||
{% do default_settings.update(flavor_map) %}
|
||||
|
||||
{## Merge in changes from the system pillar ##}
|
||||
{% set system_settings = salt['pillar.get'](
|
||||
'system',
|
||||
default=default_settings.nsswitch,
|
||||
merge=True
|
||||
) %}
|
17
system/sleep.sls
Normal file
17
system/sleep.sls
Normal file
@ -0,0 +1,17 @@
|
||||
{% from "system/map.jinja" import system_settings.sleep as settings with context %}
|
||||
|
||||
disable_sleep_target:
|
||||
service.masked:
|
||||
- name: 'sleep.target'
|
||||
|
||||
disable_suspend_target:
|
||||
service.masked:
|
||||
- name: 'suspend.target'
|
||||
|
||||
disable_hibernate_target:
|
||||
service.masked:
|
||||
- name: 'hibernate.target'
|
||||
|
||||
disable_hybrid-sleep_target:
|
||||
service.masked:
|
||||
- name: 'hybrid-sleep.target'
|
Loading…
Reference in New Issue
Block a user