I mean flags, something we use in programming with with double loops to
check outside the loop if something is found. I am trying to compare 2
different lists here and setting a flag in inner loop.
On Saturday, 6 August 2016 00:00:05 UTC+5:30, Kai Stian Olstad wrote:
>
> On 05. aug. 2016 08:07, ishan jain wrote:
> > I am trying to check if a given mount point exists for each host in my
> > playbook. I am trying to generate a kind of report by printing Success
> or
> > Failed using if-else, loops and flags (need something better than flags)
>
> Flag? Do you mean facts?
>
> > inside a jinja2 template. First i am looping through all hosts and for
> each
> > host i am looping through each ansible_mount and checking for a
> matching,
> > setting a flag:
>
> To get the variables for a host you must use hostvars.
> It's the same principle as the other mail where I showed you an example.
> You need to study that and understand how it works.
>
>
> > The problem is that i do not think this flag is properly as i always see
> > the line - Failed - Mount dir {{DIR}} not found
>
> The problem is not facts they have the information, you need to use
> hostvars.
>
>
> > I am not sure what i am doing wrong here. Is this a syntax problem or
> this
> > is never going to work ? If it is the latter, then what should i do to
> > achieve this ?
>
> If you do it correctly it will work.
> You need to study my example in my answer in your previous question.
> When you understand how that work you should be able to make this one
> work.
>
> --
> Kai Stian Olstad
>
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/8074881f-0e57-4e18-aaf8-998f1a191db4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.