Hi,

Enclosed the var and made PB as below and resulted FAILED output.

PB:
---
- hosts: localhost
  connection: local
  gather_facts: no
  tasks:
   - name: ILO Facts
     hpilo_facts:
      host: 10.20.64.51
      login: XXXXXX
      password: XXXXXX
     delegate_to: localhost

   - debug:
      var: "{{ hw_health.storage['Controller on System 
Board']['logical_drives'][0]['physical_drives']  | selectattr('status', 
'equalto', 'CRITICAL') | list }}"


ERROR:
TASK [debug] 
**************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module 
execution."}

On Wednesday, January 9, 2019 at 3:56:58 AM UTC+5:30, Kai Stian Olstad 
wrote:
>
> On Tuesday, 8 January 2019 22:21:44 CET Rama wrote: 
> > Hi, 
> > 
> > Edited the PB and it is 
> > 
> > --- 
> > - hosts: localhost 
> >   connection: local 
> >   gather_facts: no 
> >   tasks: 
> >    - name: ILO Facts 
> >      hpilo_facts: 
> >       host: 10.20.64.51 
> >       login: xxxxxxx 
> >       password: xxxxxxx 
> >      delegate_to: localhost 
> > 
> >    - debug: 
> >        var: hw_health.storage['Controller on System 
> > Board']['logical_drives'] 
> >         
> >         
> >         
> > Got output: 
> > TASK [debug] 
> > 
> **************************************************************************************************************************************
>  
>
> > ok: [localhost] => { 
> >     "hw_health.storage['Controller on System Board']['logical_drives']": 
> [ 
> >         { 
> >             "encryption_status": "Not Encrypted", 
> >             "label": "01", 
> >             "physical_drives": [ 
> >               { 
> >                 "configuration": "Configured", 
> >                 "version": "PD-0.7", 
> >                 "label": "device-1", 
> >                 "location": "1", 
> >                 "serial_number": "PWH12GVF", 
> >                 "status": "OK" 
> >               }, 
> >               { 
> >                 "configuration": "Configured", 
> >                 "version": "PD-0.7", 
> >                 "label": "device-2", 
> >                 "location": "2", 
> >                 "serial_number": "PWH12GWF", 
> >                 "status": "OK" 
> >               }, 
> >               { 
> >                 "configuration": "Configured", 
> >                 "version": "PD-0.7", 
> >                 "label": "device-3", 
> >                 "location": "3", 
> >                 "serial_number": "PWH12GXF", 
> >                 "status": "CRITICAL" 
> >               } 
> >             ], 
> >             "status": "OK" 
> >         } 
> >     ] 
> > } 
>
> This makes it easier to understand structure of the variable, you should 
> get the critical ones with this 
>
> {{ hw_health.storage['Controller on System 
> Board']['logical_drives'][0]['physical_drives']  | selectattr('status', 
> 'equalto', 'CRITICAL') | list }} 
>
>
> -- 
> 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/e73a24c7-2388-460e-ba27-b0c221982c6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to