So if I have this:
- name: Set user_show fact
set_fact:
users: "{{ item.0 }}{{ item.1 }}{{ item.2 }}"
with_together:
- "{{ user_show.results[item|int].json.result.result.uid[0] }}"
- "{{
(user_show.results[item|int].json.result.result.krbpasswordexpiration[0]['__datetime__']
| to_datetime('%Y%m%d%H%M%SZ')).strftime('%s') }}"
- "{{ (ansible_date_time.epoch|int -
((user_show.results[item|int].json.result.result.krbpasswordexpiration[0]['__datetime__']
| to_datetime('%Y%m%d%H%M%SZ')).strftime('%s'))|int) / (60*60*24) }}"
register: res
How do I add/use a loop_control variable to that? Also, with_together
seems to have been replaced by loop and the zip filter.
Thanks,
Harry
On Wednesday, December 8, 2021 at 1:57:31 PM UTC-5 [email protected] wrote:
> The problem with implementing it that way is that the users's fact is
> referencing "user_show.results[item|int], but I can't add another loop
> variable. I'm using with_sequence earlier in the playbook for testing to
> limit the amount of users queried, and that number is needed for the
> user_show.results array.
>
> You can use loop_control to use names other than item for your loop
> variables.
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#defining-inner-and-outer-variable-names-with-loop-var
>
>
--
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/6088679d-7df0-4680-b4c0-81c1a140fdebn%40googlegroups.com.