Saltstack Official OpenSSH 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.

43 lines
1.1KB

  1. include:
  2. - openssh
  3. {%- from "openssh/map.jinja" import openssh with context -%}
  4. {%- set openssh_pillar = pillar.get('openssh', {}) -%}
  5. {%- set auth = openssh_pillar.get('auth', {}) -%}
  6. {%- for user,keys in auth.items() -%}
  7. {%- for key in keys -%}
  8. {% if 'present' in key and key['present'] %}
  9. {{ key['name'] }}:
  10. ssh_auth.present:
  11. - user: {{ user }}
  12. {%- if 'source' in key %}
  13. - source: {{ key['source'] }}
  14. {%- else %}
  15. {%- if 'enc' in key %}
  16. - enc: {{ key['enc'] }}
  17. {%- endif -%}
  18. {%- if 'comment' in key %}
  19. - comment: {{ key['comment'] }}
  20. {%- endif -%}
  21. {%- if 'options' in key %}
  22. - options: {{ key['options'] }}
  23. {%- endif -%}
  24. {%- endif %}
  25. - require:
  26. - service: {{ openssh.service }}
  27. {%- else %}
  28. {{ key['name'] }}:
  29. ssh_auth.absent:
  30. - user: {{ user }}
  31. {%- if 'enc' in key %}
  32. - enc: {{ key['enc'] }}
  33. {%- endif -%}
  34. {%- if 'comment' in key %}
  35. - comment: {{ key['comment'] }}
  36. {%- endif -%}
  37. {%- if 'options' in key %}
  38. - options: {{ key['options'] }}
  39. {%- endif -%}
  40. {%- endif -%}
  41. {%- endfor -%}
  42. {%- endfor -%}