Hello, 


I need to get the number for the disk offline.

My playbook is look like the below but I stuck with the json query and I 
need you help

Thanks
  tasks: 

    - name: Get disk facts
      win_disk_facts:
      delegate_to: "{{inventory_hostname}}"
      register: win_disk_facts
      
    - name: Set the query to get the related part of the win_disk_facts
      set_fact:
        query: "ansible_facts.ansible_disks[*].?operational_status==Offline"

    - name: Get the index number of the disk letter in the disk info
      set_fact:
        index : "{{ loop_index }}"
      loop: "{{ win_disk_facts | json_query(query) }}"
      loop_control:
        index_var: loop_index
        loop_var: inner_item 
      when: inner_item | length > 0
            
    - name: Set the backing_uuid
      set_stats:
       data: 
          number: "{{ 
win_disk_facts.ansible_facts.ansible_disks[index].number}}"

-- 
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/46639167-35f3-42cf-ad5a-2a14fcfd892bn%40googlegroups.com.

Reply via email to