Saltstack Official Users Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.9KB

  1. # vim: sts=2 ts=2 sw=2 et ai
  2. {# import defaults.yaml as defaults #}
  3. {% import_yaml 'users/defaults.yaml' as defaults %}
  4. {# set Os-family specific settings #}
  5. {% set users = salt['grains.filter_by'](
  6. defaults,
  7. merge=salt['grains.filter_by']({
  8. 'MacOS': {
  9. 'sudoers_dir': '/etc/sudoers.d',
  10. 'sudoers_file': '/etc/sudoers',
  11. 'googleauth_dir': '/etc/google_authenticator.d',
  12. 'shell': '/bin/bash',
  13. 'visudo_shell': '/bin/bash',
  14. 'bash_package': 'bash',
  15. 'sudo_package': 'sudo',
  16. 'googleauth_package': 'google-authenticator-libpam',
  17. },
  18. 'Debian': {
  19. 'sudoers_dir': '/etc/sudoers.d',
  20. 'sudoers_file': '/etc/sudoers',
  21. 'googleauth_dir': '/etc/google_authenticator.d',
  22. 'root_group': 'root',
  23. 'shell': '/bin/bash',
  24. 'visudo_shell': '/bin/bash',
  25. 'bash_package': 'bash',
  26. 'sudo_package': 'sudo',
  27. 'googleauth_package': 'libpam-google-authenticator',
  28. },
  29. 'Gentoo': {
  30. 'sudoers_dir': '/etc/sudoers.d',
  31. 'sudoers_file': '/etc/sudoers',
  32. 'googleauth_dir': '/etc/google_authenticator.d',
  33. 'root_group': 'root',
  34. 'shell': '/bin/bash',
  35. 'visudo_shell': '/bin/bash',
  36. 'bash_package': 'app-shells/bash',
  37. 'sudo_package': 'app-admin/sudo',
  38. 'googleauth_package': 'libpam-google-authenticator',
  39. },
  40. 'FreeBSD': {
  41. 'sudoers_dir': '/usr/local/etc/sudoers.d',
  42. 'sudoers_file': '/usr/local/etc/sudoers',
  43. 'googleauth_dir': '/usr/local/etc/google_authenticator.d',
  44. 'root_group': 'wheel',
  45. 'shell': '/bin/csh',
  46. 'visudo_shell': '/usr/local/bin/bash',
  47. 'bash_package': 'bash',
  48. 'sudo_package': 'sudo',
  49. 'googleauth_package': 'pam_google_authenticator',
  50. },
  51. 'OpenBSD': {
  52. 'sudoers_dir': '/etc/sudoers.d',
  53. 'sudoers_file': '/etc/sudoers',
  54. 'googleauth_dir': '/etc/google_authenticator.d',
  55. 'root_group': 'wheel',
  56. 'shell': '/bin/csh',
  57. 'visudo_shell': '/usr/local/bin/bash',
  58. 'bash_package': 'bash',
  59. 'sudo_package': 'sudo',
  60. 'googleauth_package': 'pam_google_authenticator',
  61. },
  62. 'Solaris': {
  63. 'sudoers_dir': '/opt/local/etc/sudoers.d',
  64. 'sudoers_file': '/opt/local/etc/sudoers',
  65. 'googleauth_dir': '/opt/local/etc/google_authenticator.d',
  66. 'root_group': 'root',
  67. 'shell': '/bin/bash',
  68. 'visudo_shell': '/bin/bash',
  69. 'bash_package': 'bash',
  70. 'sudo_package': 'sudo',
  71. 'googleauth_package': 'libpam-google-authenticator',
  72. },
  73. 'default': {
  74. 'sudoers_dir': '/etc/sudoers.d',
  75. 'sudoers_file': '/etc/sudoers',
  76. 'googleauth_dir': '/etc/google_authenticator.d',
  77. 'root_group': 'root',
  78. 'shell': '/bin/bash',
  79. 'visudo_shell': '/bin/bash',
  80. 'bash_package': 'bash',
  81. 'sudo_package': 'sudo',
  82. 'googleauth_package': 'libpam-google-authenticator',
  83. },
  84. }, merge=salt['pillar.get']('users-formula:lookup')),
  85. base='users',
  86. ) %}
  87. {% if grains.os == 'MacOS' %}
  88. {% set group = salt['cmd.run']("stat -f '%Sg' /dev/console") %}
  89. {% do users.update({'root_group': group,}) %}
  90. {% endif %}