You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hetzner-ansible/roles/keycloak/tasks/_authenticate.yml

22 lines
650 B
YAML

---
- name: "Authenticating with keycloak server"
uri:
url: "{{ keycloak_server_url }}/auth/realms/master/protocol/openid-connect/token"
method: POST
body_format: form-urlencoded
body: 'username={{ keycloak_admin_username }}&password={{ keycloak_admin_password }}&client_id=admin-cli&grant_type=password'
register: keycloak_authentication
delegate_to: 127.0.0.1
retries: 5
delay: 5
- name: "Saving access_token as variable (fact)"
set_fact:
access_token: "{{ keycloak_authentication.json.access_token }}"
- name: "Printing access_token for keycloak server"
debug:
msg: "{{ access_token }}"
when:
- debug