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 !

On Fri, 24 Jul 2020 at 12:34, Stefan Hornburg (Racke) <[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:
> [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].
> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAGH8rEzL0RS1qrcVFj0-QJE_%2Bh09XJ2Dsp%2BDf9YjLMCJeY4Rxg%40mail.gmail.com.

Reply via email to