Hi Experts,

I am trying to check the diskspace on remote servers but it failing . Could 
someone please help.

Playbook.yml

---
- hosts: all
  gather_facts: no
  vars_files:
      - /etc/ansible/xyz/pre-deploy/vars/main.yml

  tasks:
  - name: Ensure that free space on the tested volume is greater than 15%
    assert:
      that: item.size_available > item.size_total|float * 0.3
      msg: Disk space has reached 85% threshold
    when: item.mount == mountname
    with_items: "{{ ansible_mounts }}"


vars/main.yml

ansible_mounts:
- xyz
- abc

ERROR: 

FAILED! => {"msg": "The conditional check 'item.mount == mountname' failed. 
The error was: error while evaluating conditional (item.mount == 
mountname): 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no 
attribute 'mount'\n\nThe error appears to have been in 
'/etc/ansible/xyz/pre-deploy/tasks/disk.yml': line 8, column 5, but may\nbe 
elsewhere in the file depending on the exact syntax problem.\n\nThe 
offending line appears to be:\n\n  tasks:\n  - name: Ensure that free space 
on the tested volume is greater than 15%\n    ^ here\n"}

-- 
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/cd064e4b-79fb-4788-9607-567a64421f93%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to