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.

75 lines
2.4KB

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