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
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 factswin_disk_facts:delegate_to: "{{inventory_hostname}}"
register: win_disk_facts
hostvars host facts and can be referenced by name just like any other host fact. They do not need to be registered in order to use them.- name: Set the query to get the related part of the win_disk_factsset_fact:query: "ansible_facts.ansible_disks[*].?operational_status==Offline"- name: Get the index number of the disk letter in the disk infoset_fact:index : "{{ loop_index }}"loop: "{{ win_disk_facts | json_query(query) }}"loop_control:index_var: loop_indexloop_var: inner_itemwhen: inner_item | length > 0- name: Set the backing_uuidset_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 ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/46639167-35f3-42cf-ad5a-2a14fcfd892bn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLZMxwQhBV%2BfybfXKWqiHp20Q%3DNdJGdXrqQVdRJ3ZjVU3A%40mail.gmail.com.