mirror of
https://github.com/saltstack-formulas/users-formula.git
synced 2024-12-18 10:32:55 +01:00
99 lines
3.1 KiB
Django/Jinja
99 lines
3.1 KiB
Django/Jinja
# vim: sts=2 ts=2 sw=2 et ai
|
|
|
|
{# import defaults.yaml as defaults #}
|
|
{% import_yaml 'users/defaults.yaml' as defaults %}
|
|
|
|
{# set Os-family specific settings #}
|
|
{% set users = salt['grains.filter_by'](
|
|
defaults,
|
|
merge=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',
|
|
'googleauth_dir': '/etc/google_authenticator.d',
|
|
'root_group': 'root',
|
|
'shell': '/bin/bash',
|
|
'visudo_shell': '/bin/bash',
|
|
'bash_package': 'bash',
|
|
'sudo_package': 'sudo',
|
|
'googleauth_package': 'libpam-google-authenticator',
|
|
'polkit_dir': '/etc/polkit-1/localauthority.conf.d',
|
|
'polkit_defaults': 'unix-group:sudo;'
|
|
},
|
|
'Gentoo': {
|
|
'sudoers_dir': '/etc/sudoers.d',
|
|
'sudoers_file': '/etc/sudoers',
|
|
'googleauth_dir': '/etc/google_authenticator.d',
|
|
'root_group': 'root',
|
|
'shell': '/bin/bash',
|
|
'visudo_shell': '/bin/bash',
|
|
'bash_package': 'app-shells/bash',
|
|
'sudo_package': 'app-admin/sudo',
|
|
'googleauth_package': 'libpam-google-authenticator',
|
|
},
|
|
'FreeBSD': {
|
|
'sudoers_dir': '/usr/local/etc/sudoers.d',
|
|
'sudoers_file': '/usr/local/etc/sudoers',
|
|
'googleauth_dir': '/usr/local/etc/google_authenticator.d',
|
|
'root_group': 'wheel',
|
|
'shell': '/bin/csh',
|
|
'visudo_shell': '/usr/local/bin/bash',
|
|
'bash_package': 'bash',
|
|
'sudo_package': 'sudo',
|
|
'googleauth_package': 'pam_google_authenticator',
|
|
},
|
|
'OpenBSD': {
|
|
'sudoers_dir': '/etc/sudoers.d',
|
|
'sudoers_file': '/etc/sudoers',
|
|
'googleauth_dir': '/etc/google_authenticator.d',
|
|
'root_group': 'wheel',
|
|
'shell': '/bin/csh',
|
|
'visudo_shell': '/usr/local/bin/bash',
|
|
'bash_package': 'bash',
|
|
'sudo_package': 'sudo',
|
|
'googleauth_package': 'pam_google_authenticator',
|
|
},
|
|
'Solaris': {
|
|
'sudoers_dir': '/opt/local/etc/sudoers.d',
|
|
'sudoers_file': '/opt/local/etc/sudoers',
|
|
'googleauth_dir': '/opt/local/etc/google_authenticator.d',
|
|
'root_group': 'root',
|
|
'shell': '/bin/bash',
|
|
'visudo_shell': '/bin/bash',
|
|
'bash_package': 'bash',
|
|
'sudo_package': 'sudo',
|
|
'googleauth_package': 'libpam-google-authenticator',
|
|
},
|
|
'default': {
|
|
'sudoers_dir': '/etc/sudoers.d',
|
|
'sudoers_file': '/etc/sudoers',
|
|
'googleauth_dir': '/etc/google_authenticator.d',
|
|
'root_group': 'root',
|
|
'shell': '/bin/bash',
|
|
'visudo_shell': '/bin/bash',
|
|
'bash_package': 'bash',
|
|
'sudo_package': 'sudo',
|
|
'googleauth_package': 'libpam-google-authenticator',
|
|
'polkit_dir': '/etc/polkit-1/localauthority.conf.d',
|
|
'polkit_defaults': 'unix-group:sudo;'
|
|
},
|
|
}, merge=salt['pillar.get']('users-formula:lookup')),
|
|
base='users',
|
|
) %}
|
|
|
|
{% if grains.os == 'MacOS' %}
|
|
{% set group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
|
|
{% do users.update({'root_group': group,
|
|
'prime_group': group}) %}
|
|
{%- endif %}
|