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.

28 lines
1009 B

  1. ---
  2. - name: shared/gen_userpass | Create the Username/Password combo for the role
  3. uri:
  4. url: "{{ hostvars[groups.vault|first]['vault_leader_url'] }}/v1/auth/userpass/users/{{ gen_userpass_username }}"
  5. headers: "{{ hostvars[groups.vault|first]['vault_headers'] }}"
  6. method: POST
  7. body_format: json
  8. body:
  9. username: "{{ gen_userpass_username }}"
  10. password: "{{ gen_userpass_password }}"
  11. policies: "{{ gen_userpass_role }}"
  12. status_code: 204
  13. delegate_to: "{{ groups.vault|first }}"
  14. run_once: true
  15. - name: shared/gen_userpass | Ensure destination directory exists
  16. file:
  17. path: "{{ vault_roles_dir }}/{{ gen_userpass_role }}"
  18. state: directory
  19. - name: shared/gen_userpass | Copy credentials to all hosts in the group
  20. copy:
  21. content: >
  22. {{
  23. {'username': gen_userpass_username,
  24. 'password': gen_userpass_password} | to_nice_json(indent=4)
  25. }}
  26. dest: "{{ vault_roles_dir }}/{{ gen_userpass_role }}/userpass"