vault_create_secret.yml

This tasks file will add the rhaap_admin secret to the created namespace.
The rhaap_admin secret is the organization admin for the configuration as code for this organization.

- name: Create secret
  ansible.builtin.uri:
    url: "{{ vault_url }}/v1/kv/data/{{ secret_name }}"
    method: POST
    headers:
      X-Vault-Token: "{{ vault_token }}"
      X-Vault-Namespace: "{{ main_ns_name }}/{{ sub_ns_name }}"
      Content-type: "application/json"
    body_format: json
    body: |
      {
      "data": {
         "username": "{{ org_admin_user }}",
         "password": "{{ team_password }}",
         "hostname": "{{ rhaap_hostname }}",
         "validate_certs": "false"
        }
      }
    timeout: 10
    validate_certs: false