On 7/24/20 2:25 PM, Rahul Kumar wrote: > sorry evaluate result.content.allstarted only when result.failed == true >
As I said, fix the API problems instead of going into a series of rabbit holes
with these conditions on the Ansible side.
Regards
Racke
> On Fri, 24 Jul 2020 at 17:52, Rahul Kumar <[email protected]
> <mailto:[email protected]>> wrote:
>
> ok thanks ! I need one more help:
>
> suppose i have a statement like :
> until: result.failed == False and result is succeeded and
> result.content.allstarted in a task !
>
> But i get error saying dict has no attribute allstarted ! Actually that
> is true also because this attribute comes
> only when result.failed == false ! But here until is trying to evaluate
> all 3 conditions together ! Is there any
> ways in which we can say that evaluate result.content.allstarted only
> when result.failed== false in until clause !
>
> On Fri, 24 Jul 2020 at 13:05, Stefan Hornburg (Racke) <[email protected]
> <mailto:[email protected]>> wrote:
>
> On 7/24/20 9:14 AM, Rahul Kumar wrote:
> > my idea is: i don't want to stop the execution if this rest call is
> failed ! what i want that if this task
> failed , it
> > should be skipped rather than failing entire execution !
> > Notice i dont want to use ignore_error kind of then , i want
> something conditional !
>
> Hello Rahul,
>
> you can override the failed state with failed_when instead of when,
> e.g.
>
> failed_when: false
>
> However that doesn't make sense. You should fix the problem in your
> API / in calling your API.
>
> Regards
> Racke
>
> >
> > On Fri, 24 Jul 2020 at 12:42, Stefan Hornburg (Racke)
> <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>> wrote:
> >
> > On 7/24/20 9:07 AM, Rahul Kumar wrote:
> > > Here it is :
> > > - name: my service shut
> > > my_service:
> > > baseUrl: "{{ base_rest_url }}"
> > > tasks:
> > > - action: service_shut
> > > operation: shut
> > > hostname: "{{ ansible_fqdn }}"
> > > instance: "{{ item.instance }}"
> > > state: present
> > > register: result
> > > with_items: "{{ my_instances_config }}"
> > > when: result is not failed
> > >
> > > here my_service is custom python module !
> >
> > Hello Rahul,
> >
> > the condition is check for each item in "my_instances_config"
> *before* running the task.
> >
> > So it doesn't make sense to use "result" there as it is
> registered *after* running the task.
> >
> > What is the idea behind your condition?
> >
> > Regards
> > Racke
> >
> > >
> > > On Fri, 24 Jul 2020 at 12:34, Stefan Hornburg (Racke)
> <[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>
> > <mailto:[email protected] <mailto:[email protected]>
> <mailto:[email protected] <mailto:[email protected]>>>>
> wrote:
> > >
> > > On 7/24/20 8:59 AM, Rahul Kumar wrote:
> > > > Hi Ansible Gurus,,
> > > > I have this output:
> > > > <myapp> (1, '\r\n{"msg": "service[component] -
> https://myip/myrest/v1/ fails to due to error 501
> - None",
> > "failed":
> > > > true, "invocation": {"module_args": {"url_password":
> null, "tasks": [{"name": null, "hostname":
> "myapp",
> > "timeout":
> > > > "60", "my_post_action": "component", "operation":
> "shut, "instance": "abc"}], "force": false,
> "homedir": null,
> > > > "service": null, "url": null, "force_basic_auth":
> false, "http_agent": "ansible-httpget",
> "cluster": "homedir",
> > > "state":
> > > > "present", "BaseUrl": "https://myapp/myrest/api/v1",
> "url_username": null, "client_key": null,
> "validate_certs":
> > > false,
> > > > "client_cert": null, "use_proxy": true}}}\r\n', 'Shared
> connection to myapp closed.\r\n')
> > > >
> > > > But when i put condition on a registered variable
> > > > when : result is not failed ,
> > > > it says :
> > > > The 'failed' test expects a dictionary\n Error how can
> i put this condition then ?
> > > >
> > > > Rahul
> > >
> > > Please share the relevant details about your playbook /
> task / inventory.
> > >
> > > 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:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>
> > <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>>
> > > <mailto:[email protected]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>
> > <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>>>.
> > > > To view this discussion on the web visit
> > > >
> >
>
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEyMSR7Y0UAED9mi6EiUC2r1WbC9UMF7ONRHSQAJ9yScQQ%40mail.gmail.com
> > > >
> > >
> >
>
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEyMSR7Y0UAED9mi6EiUC2r1WbC9UMF7ONRHSQAJ9yScQQ%40mail.gmail.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]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>
> > <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>>.
> > > To view this discussion on the web visit
> > >
> https://groups.google.com/d/msgid/ansible-project/c2e3ff76-43e9-dfc9-c186-8fe526eefc24%40linuxia.de.
> > >
> > > --
> > > 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:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>
> > <mailto:[email protected]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>>.
> > > To view this discussion on the web visit
> > >
> >
>
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEzL0RS1qrcVFj0-QJE_%2Bh09XJ2Dsp%2BDf9YjLMCJeY4Rxg%40mail.gmail.com
> > >
> >
>
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEzL0RS1qrcVFj0-QJE_%2Bh09XJ2Dsp%2BDf9YjLMCJeY4Rxg%40mail.gmail.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]
> <mailto:ansible-project%[email protected]>
> <mailto:ansible-project%[email protected]
> <mailto:ansible-project%[email protected]>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/edbe8d95-1541-7659-bbf8-846c30a8ae5e%40linuxia.de.
> >
> > --
> > 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:ansible-project%[email protected]>
> <mailto:[email protected]
> <mailto:ansible-project%[email protected]>>.
> > To view this discussion on the web visit
> >
>
> https://groups.google.com/d/msgid/ansible-project/CAGH8rEw5anLLKNRRXqaDYFzmG0jJEGqB45MjdkSZ1ZhVDLhtUg%40mail.gmail.com
> >
>
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEw5anLLKNRRXqaDYFzmG0jJEGqB45MjdkSZ1ZhVDLhtUg%40mail.gmail.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]
> <mailto:ansible-project%[email protected]>.
> To view this discussion on the web visit
>
> https://groups.google.com/d/msgid/ansible-project/78f83bbf-1885-08e8-028b-a1f2b499720e%40linuxia.de.
>
> --
> 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/CAGH8rEzrhn443ghJqp9%2BAh0nRyrM-rzFBBsv%2BP50zvGBcGAVHA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAGH8rEzrhn443ghJqp9%2BAh0nRyrM-rzFBBsv%2BP50zvGBcGAVHA%40mail.gmail.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/83e39133-e311-47a0-0e7a-8b7302e402dd%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
