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.

79 lines
2.4KB

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