My Ansible Playbook to install an OpenShift Lab
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.

45 lines
1.4 KiB

---
- name: Create the Demo User
uri:
url: https://{{ sso_route_name }}/auth/admin/realms/{{ sso_realm }}/users
validate_certs: no
headers:
Authorization: 'Bearer {{ access_token }}'
method: POST
body: "{{ sso_demo_user }}"
body_format: json
status_code: "201,409"
register: response
changed_when: response.status == 201
- set_fact:
user_has_been_created: true
user_url: "{{ response.location }}"
when: response.status == 201
- name: Retrieve the id of the Demo User
uri:
url: 'https://{{ sso_route_name }}/auth/admin/realms/{{ sso_realm }}/users?username={{ sso_demo_user.username|urlencode }}'
validate_certs: no
headers:
Authorization: 'Bearer {{ access_token }}'
register: response
changed_when: false
failed_when: response.status != 200 or (response.json|length != 1)
when: user_has_been_created is not defined
- set_fact:
user_url: "https://{{ sso_route_name }}/auth/admin/realms/{{ sso_realm }}/users/{{ response.json[0].id }}"
when: user_has_been_created is not defined
- name: Set the password of the Demo User
uri:
url: "{{ user_url }}/reset-password"
validate_certs: no
headers:
Authorization: 'Bearer {{ access_token }}'
method: PUT
body: "{{ sso_demo_user.credentials[0] }}"
body_format: json
status_code: 204