Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

59 lines
1.9KB

  1. ---
  2. secrets_generators:
  3. - password
  4. #- xkcd
  5. secrets_stores:
  6. - facts
  7. - local_facts
  8. secrets_set: |-
  9. {
  10. {% for secret_name in secrets_definitions.keys() %}
  11. {% set secrets_definition = secrets_definitions[secret_name] %}
  12. {% set password_length = secrets_definition.password_length | default(secrets_default_password_length) | string %}
  13. {% set password_chars = secrets_definition.password_chars|default(secrets_default_password_chars) %}
  14. {{secret_name|to_json}}:
  15. {{ lookup('password', '/dev/null length='+password_length+' chars='+password_chars ) | to_json }}
  16. ,
  17. {% endfor %}
  18. }
  19. secrets_reset: |-
  20. {
  21. {% for secret_name in secrets_definitions.keys() %}
  22. {% set secrets_definition = secrets_definitions[secret_name] %}
  23. {% if secrets_definition.reset | default(false) %}
  24. {{secret_name|to_json}}: {{ secrets_set[secret_name] | to_json }},
  25. {% endif %}
  26. {% endfor %}
  27. }
  28. secrets_set_by_store: |-
  29. {
  30. {% for store_name in secrets_stores %}
  31. {{store_name|to_json}}: {
  32. {% for secret_name in secrets_set.keys() %}
  33. {% set secrets_definition = secrets_definitions[secret_name] %}
  34. {% if store_name == secrets_definition.store | default(secrets_default_store) %}
  35. {{secret_name|to_json}}: {{ secrets_set[secret_name] | to_json }},
  36. {% endif %}
  37. {% endfor %}
  38. },
  39. {% endfor %}
  40. }
  41. secrets_reset_by_store: |-
  42. {
  43. {% for store_name in secrets_stores %}
  44. {{store_name|to_json}}: {
  45. {% for secret_name in secrets_reset.keys() %}
  46. {% set secrets_definition = secrets_definitions[secret_name] %}
  47. {% if store_name == secrets_definition.store | default(secrets_default_store) %}
  48. {{secret_name|to_json}}: {{ secrets_reset[secret_name] | to_json }},
  49. {% endif %}
  50. {% endfor %}
  51. },
  52. {% endfor %}
  53. }