I am traversing our IPA server to get find all users, then I want to loop
through all of them to get their password expiration date. I use the IPA
API via the uri module and register the variable, but no matter what I try
to access the uid of each found user, I get the following error:
TASK [Run user_show from IDM API using previously stored session cookie]
**********************************************************
fatal: [localhost]: FAILED! => {"msg": "template error while templating
string: expected name or number. String: {\"method\":
\"user_show\",\"params\": [[ \"{{ item[0].['uid'] }}\"],{\"all\":
true,\"version\": \"{{ api_vers }}\"}]}"}
Here's the section of my playbook that seems to be giving me issues:
- name: Run user_find from IDM API using previously stored session cookie
uri:
url: "https://{{idmfqdn}}/ipa/session/json"
method: POST
headers:
Cookie: "{{ login.set_cookie }}"
Referer: "https://{{idmfqdn}}/ipa"
Content-Type: "application/json"
Accept: "application/json"
body_format: json
body: "{\"method\": \"user_find/1\",\"params\": [[],{\"version\":
\"{{ api_vers }}\"}]}"
register: user_find
- name: Run user_show from IDM API using previously stored session cookie
uri:
url: "https://{{idmfqdn}}/ipa/session/json"
method: POST
headers:
Cookie: "{{ login.set_cookie }}"
Referer: "https://{{idmfqdn}}/ipa"
Content-Type: "application/json"
Accept: "application/json"
body_format: json
body: "{\"method\": \"user_show\",\"params\": [[ \"{{ item[0].['uid']
}}\"],{\"all\": true,\"version\": \"{{ api_vers }}\"}]}"
register: user_show
loop:
- "{{ user_find.json.result.result }}"
Thanks,
Harry
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/8d23726b-b764-44d8-a0c8-88d2e3d7062bn%40googlegroups.com.