[ansible-project] Re: win_disk_facts - get size and size remaining

2018-05-14 Thread Jeremie Levy
I found how to loop over the data, but i still didn't figure out how to 
select inside specific data
- name: test 1
debug: 
msg: "{{ item.key }}"
with_dict: "{{ ansible_disks }}"


Got:

ok: [hostname] => (item=None) => {  




"msg": "partitions"



  
}




If trying to dig into partitions 
{{ item.value.partitions }}
"msg": "The task includes an option with an undefined variable. The error 
was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 
'partitions'



Any chance someone give an input, it seems just a json gap i have and not 
ansible actually.


Thanks!


On Thursday, May 10, 2018 at 2:22:46 PM UTC+3, Jeremie Levy wrote:
>
> Hi
> I'm trying to use win_disk_facts new module.
>
> I would like to get the size and remaining size of each 
> disk/partition/volume.
>
> Is there a way to "discover" how many of them there are in a kind of loop ?
>
> - name: Get disk facts
> win_disk_facts:
>   - name: Output first disk size
> debug:
>   msg: '{{ disk1s }}' 
> vars: 
>   disk1s: '{{ ansible_facts.disks[0].partitions[0].volumes[0].size }}'
>
> This one gives me info on the first partition, what about the others ? if 
> there is 1 or 20 ?
>
> Thanks!
>
> @marqelme
> @jborean93
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b7bb9966-a7a1-4253-a2f4-4769d67e819e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: win_disk_facts - get size and size remaining

2018-05-10 Thread Varun Chopra
This is pretty much why I was in favor of a separate module for volumes. 
I'd encountered the same issues but I ended up making my own module for 
it.  You can take a look at this if it suits your fancy: 
https://github.com/chopraaa/win_volume_facts/

It's kinda shit tbh but hey, it does the job.

On Thursday, May 10, 2018 at 4:52:46 PM UTC+5:30, Jeremie Levy wrote:
>
> Hi
> I'm trying to use win_disk_facts new module.
>
> I would like to get the size and remaining size of each 
> disk/partition/volume.
>
> Is there a way to "discover" how many of them there are in a kind of loop ?
>
> - name: Get disk facts
> win_disk_facts:
>   - name: Output first disk size
> debug:
>   msg: '{{ disk1s }}' 
> vars: 
>   disk1s: '{{ ansible_facts.disks[0].partitions[0].volumes[0].size }}'
>
> This one gives me info on the first partition, what about the others ? if 
> there is 1 or 20 ?
>
> Thanks!
>
> @marqelme
> @jborean93
>

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a42f050d-cc1c-4461-b66d-602daa38ba36%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.