On Mon, Nov 2, 2020 at 8:08 AM Luke C <[email protected]> wrote:
>
> Thanks for the reply.
> Yes I know ... :)
>
> The problem is that I want to have dynamic when conditions for huge amount of
> tasks.
> With standard when condition I would have to provide a particular static
> condition for each task (which in fact are mostly external script executions).
> I thought it would be just easier and faster with additional callback module.
>
I too am confused. I use when() to include an entire task file
or just do a task. And I could swear I have whens that looked like
when:
- variable-I-populated-or-registered-a-few-lines-ago.stdout ==
variable-I-populated-in-an-earlier-task-file-on-my-way-here.stdout
> Kind regards
> Luke
>
>
> poniedziaĆek, 2 listopada 2020 o 13:57:43 UTC+1 [email protected] napisaĆ(a):
>>
>> On 11/2/20 1:49 PM, Luke C wrote:
>> > Hey guys
>> >
>> > I would like to ask whether it's possible to SKIP task programmatically,
>> > using python & callback module?
>> >
>> > I've been trying to do this for 3 days and I still don't know how.
>> > Is there some special variable which I could use in *v2_runner_on_start
>> > *or *v2_playbook_on_task_start* methods?
>> >
>> > I don't want to use ansible's when condition, task should be omitted
>> > dynamically basing on the results gathered earlier.
>> >
>> > e.g.:
>> > def v2_runner_on_start(self, host, task):
>> > if self.checksomething():
>> > print("Task should be omitted")
>> > <OMIT TASK, DO NOT RUN IT>
>> > else:
>> > print("Yes, task should be executed, proceed")
>> >
>> >
>>
>> Do you know that Ansible's when conditions can be very well based on results
>> gathered earlier?
>>
>> Regards
>> Racke
>>
>> >
>> >
>> > --
>> > 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]
>> > <mailto:[email protected]>.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msgid/ansible-project/34e2ed5a-2fad-40cf-a852-f94af07fd096n%40googlegroups.com
>> > <https://groups.google.com/d/msgid/ansible-project/34e2ed5a-2fad-40cf-a852-f94af07fd096n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>
>>
>> --
>> Ecommerce and Linux consulting + Perl and web application programming.
>> Debian and Sympa administration. Provisioning with Ansible.
>
> --
> 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/f1b9d8c6-f367-4c75-b812-226a4eb7b82bn%40googlegroups.com.
--
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/CAHEKYV4c7y7bJjDScFcohAzGWjzNOGyxVxWTnDZCQvGh0Qa-pQ%40mail.gmail.com.