From 5b812c749afe76a4b97449191f4e7f64d89f1d81 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Mon, 17 Aug 2020 08:03:41 +0200 Subject: [PATCH] added groups and polkit rules --- salt/pillars/hosts/exsilio.sls | 4 ++++ salt/pillars/top.sls | 1 + salt/states/files/40-custom.rules | 3 +++ salt/states/groups.sls | 7 +++++++ salt/states/top.sls | 2 ++ 5 files changed, 17 insertions(+) create mode 100644 salt/states/files/40-custom.rules create mode 100644 salt/states/groups.sls diff --git a/salt/pillars/hosts/exsilio.sls b/salt/pillars/hosts/exsilio.sls index 4faa42c..dde3658 100644 --- a/salt/pillars/hosts/exsilio.sls +++ b/salt/pillars/hosts/exsilio.sls @@ -10,3 +10,7 @@ packages: firefox: addons: Okta Browser Plugin: https://addons.mozilla.org/en-US/firefox/addon/okta-browser-plugin/ + +groups: + libvirt: + kvm: diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 58a6af8..57e7ccd 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -6,6 +6,7 @@ base: - hosts - repos.google_chrome - firewalld + - groups {% if grains['os'] == "SUSE" -%} - repos.packman {% endif %} diff --git a/salt/states/files/40-custom.rules b/salt/states/files/40-custom.rules new file mode 100644 index 0000000..da2c5c0 --- /dev/null +++ b/salt/states/files/40-custom.rules @@ -0,0 +1,3 @@ +polkit.addAdminRule(function(action, subject) { + return ["unix-group:wheel"]; +}); diff --git a/salt/states/groups.sls b/salt/states/groups.sls new file mode 100644 index 0000000..173394b --- /dev/null +++ b/salt/states/groups.sls @@ -0,0 +1,7 @@ +add {{ pillar['username'] }} to optional groups: + user.present: + - name: {{ pillar['username'] }} + - optional_groups: + {% for group, args in pillar['groups'].items() -%} + - {{ group }} + {% endfor %} diff --git a/salt/states/top.sls b/salt/states/top.sls index 55c20ff..f4fdfef 100644 --- a/salt/states/top.sls +++ b/salt/states/top.sls @@ -7,3 +7,5 @@ base: - firefox - sudo - firewalld + - groups + - polkit