Initial commit
[ta/infra-ansible.git] / roles / access-management / templates / keystone_users_patch.sh.j2
1 #!/bin/sh
2
3 result=$(\
4 curl -i \
5   -H "Content-Type: application/json" \
6   -d '
7 { "auth": {
8     "identity": {
9       "methods": ["password"],
10       "password": {
11         "user": {
12           "name": "{{ infrastructure_admin_user_name }}",
13           "domain": { "id": "{{ am_project_domain }}" },
14           "password": "{{ infrastructure_admin_password }}"
15         }
16       }
17     },
18     "scope": {
19       "project": {
20         "name": "{{ am_project_name }}",
21         "domain": { "id": "{{ am_project_domain }}" }
22       }
23     }
24   }
25 }' \
26   -X POST "{{ keystone_service_internalurl }}/auth/tokens" |grep X-Subject-Token | cut -c 17-); echo $result
27
28 {% for i in keystone_uuids.results %}
29 curl -i \
30   -H "X-Auth-Token:${result::-1}" \
31   -H "Content-Type: application/json" \
32   -d '
33 {
34     "user": {
35         "options": {
36             "ignore_change_password_upon_first_use": true,
37             "ignore_lockout_failure_attempts": true,
38             "ignore_password_expiry": true
39         }
40     }
41 }' \
42   -X PATCH "{{ keystone_service_internalurl }}/users/{{ i.ansible_facts.keystone_facts.id }}";echo
43 {% endfor %}