Howto access 'exists' from a register: var which has results?
31 views
Skip to first unread message
Patrick Ansible-ML
unread,
Sep 15, 2014, 9:56:43 AM9/15/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
Hi,
I have a task which checks if some files exist and does a register. In
the next task, how do I access the exists: [false|true] result for use
in 'when:'? I tried variations of things like this:
'repos_extra_installed.results.stats.exists == false'
but I always get an error.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
It should be repos_extra_installed.results[0].stat.exists.
It's more complicated because you're doing a with_items on the task
that does the register. So each item in that list will have a separate
entry in the repos_extra_installed.results list.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
On 15-09-14 16:02, Michael Peters wrote:
> It should be repos_extra_installed.results[0].stat.exists.
>
> It's more complicated because you're doing a with_items on the task
> that does the register. So each item in that list will have a separate
> entry in the repos_extra_installed.results list.