users-formula/users/map.jinja

83 lines
2.6 KiB
Plaintext
Raw Normal View History

# vim: sts=2 ts=2 sw=2 et ai
2018-03-17 00:32:46 +01:00
2018-07-22 17:12:05 +02:00
{# import defaults.yaml as defaults #}
{% import_yaml 'users/defaults.yaml' as defaults %}
{# set Os-family specific settings #}
2018-06-12 19:02:57 +02:00
{% set users = salt['grains.filter_by'](
defaults,
merge=salt['grains.filter_by']({
2018-03-17 00:32:46 +01:00
'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',
2018-06-12 19:02:57 +02:00
},
'Debian': {
2014-10-25 04:57:44 +02:00
'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',
2018-06-12 19:02:57 +02:00
},
2014-05-31 13:15:03 +02:00
'Gentoo': {
2014-10-25 04:57:44 +02:00
'sudoers_dir': '/etc/sudoers.d',
2014-05-31 13:15:03 +02:00
'sudoers_file': '/etc/sudoers',
'googleauth_dir': '/etc/google_authenticator.d',
2014-05-31 13:15:03 +02:00
'root_group': 'root',
'shell': '/bin/bash',
2014-05-31 13:15:03 +02:00
'visudo_shell': '/bin/bash',
'bash_package': 'app-shells/bash',
'sudo_package': 'app-admin/sudo',
'googleauth_package': 'libpam-google-authenticator',
2018-06-12 19:02:57 +02:00
},
'FreeBSD': {
2014-10-25 04:57:44 +02:00
'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',
2018-06-12 19:02:57 +02:00
},
2017-06-05 15:41:53 +02:00
'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',
2018-06-12 19:02:57 +02:00
},
'default': {
2014-10-25 04:57:44 +02:00
'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',
2018-06-12 19:02:57 +02:00
},
}, merge=salt['pillar.get']('users-formula:lookup')),
base='users',
) %}
2018-03-17 00:32:46 +01:00
{% if grains.os == 'MacOS' %}
{% set group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
{% do users.update({'root_group': group,}) %}
{% endif %}