From ad10ec4d94db5b808cb37065f2c73958bcc8c1b6 Mon Sep 17 00:00:00 2001 From: noelmcloughlin Date: Fri, 16 Mar 2018 23:32:46 +0000 Subject: [PATCH] corrected users handling on Darwin --- users/map.jinja | 16 ++++++++++++++++ users/sudo.sls | 1 + 2 files changed, 17 insertions(+) diff --git a/users/map.jinja b/users/map.jinja index 5b365ac..fcc573b 100644 --- a/users/map.jinja +++ b/users/map.jinja @@ -1,5 +1,16 @@ # vim: sts=2 ts=2 sw=2 et ai + {% set users = salt['grains.filter_by']({ + 'MacOS': { + 'sudoers_dir': '/etc/sudoers.d', + 'sudoers_file': '/etc/sudoers', + 'googleauth_dir': '/etc/google_authenticator.d', + 'shell': '/bin/bash', + 'visudo_shell': '/bin/bash', + 'bash_package': 'bash', + 'sudo_package': 'sudo', + 'googleauth_package': 'google-authenticator-libpam', + }, 'Debian': { 'sudoers_dir': '/etc/sudoers.d', 'sudoers_file': '/etc/sudoers', @@ -56,3 +67,8 @@ 'googleauth_package': 'libpam-google-authenticator', }, }, merge=salt['pillar.get']('users-formula:lookup')) %} + +{% if grains.os == 'MacOS' %} + {% set group = salt['cmd.run']("stat -f '%Sg' /dev/console") %} + {% do users.update({'root_group': group,}) %} +{% endif %} diff --git a/users/sudo.sls b/users/sudo.sls index 092d004..e87acbb 100644 --- a/users/sudo.sls +++ b/users/sudo.sls @@ -11,6 +11,7 @@ users_sudo-package: - name: {{ users.sudo_package }} - require: - file: {{ users.sudoers_dir }} + - unless: test "`uname`" = "Darwin" users_{{ users.sudoers_dir }}: file.directory: