title: Ansible to check diskspace for mounts mentioned as variable
body: <p>I am new to ansible and currently working on a play which will see if disk space of remote machines has reached 70% threshold. If they have reached it should throw error. </p>
  
  <p>i found a good example at : <a href="https://stackoverflow.com/questions/26981907/using-ansible-to-manage-disk-space">Using ansible to manage disk space</a></p>
  
  <p>but at this example the mount names are hard coded. And my requirement is to pass them dynamically. So i wrote below code which seems to not work:</p>
  
  <pre><code>    name: test for available disk space
      assert:
      that: 
      - not {{ item.mount == '{{mountname}}' and ( item.size_available &lt; 
      item.size_total - ( item.size_total|float * 0.7 ) ) }}
      with_items: '{{ansible_mounts}}'
      ignore_errors: yes
      register: disk_free
  
      name: Fail the play
      fail: msg="disk space has reached 70% threshold"
      when: disk_free|failed
  </code></pre>
  
  <p>This play works when i use:</p>
  
  <pre><code>item.mount == '/var/app'
  </code></pre>
  
  <p>Is there any way to enter mountname dynamically ? and can i enter multiple mount names ??</p>
  
  <p>I am using ansible 2.3 on rhel</p>
  
  <p>Thanks in advance :)</p>