On Tuesday, 22 January 2019 15:42:21 CET [email protected] wrote:
> 
> i have to follwing fact structure...how to access the "size_available" 
> stuff from the opt filesystem?
> 
> i tried this but it looks dorky...
> 
> - name: check free space on /opt
>   aix_filesystem:
>                 filesystem: /opt
>                 size: +1G 
>                 state: present
>   when: ansible_facts["mounts"]["mount"] == "/opt" and
>         ansible_facts["mounts"]["size_available"] < 1073741824 
> 
> there should be a "one line" solution imho.
> 
> 
> 
> "mounts": [
> 
> { 
> "device": "/dev/hd4", 
> "fstype": "jfs2", 
> "mount": "/opt", 
> "options": "rw,log=/dev/hd8", 
> "size_available": 92508160, 
> "size_total": 134217728, 
> "time": "May 05 14:39" 
> } 
> ];

Your mount is a list so you need to specify the element 0 for them both

ansible_facts["mounts"][0]["mount"]
ansible_facts["mounts"][0]["size_available"]


-- 
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/4951266.dySPjf61Hy%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to