title: ansible when comparing integer values
body: <p>This role attempts to get cpu temperatures from raspberry pi computers (host1 only in this case), check whether docker container boinc_universeathome is running, and then if the container is running and the cpu temp > highThresholdTrigger then it should pause the container.</p>
  
  <p>If i run this without the when clauses in the role, then correctly it always pauses the container.</p>
  
  <p>Why does it not work when the when clauses are present ever? i expect that with the when clauses present, it should only pause the container when the condition is met. But the condition is never met.</p>
  
  <p>Presumably this is because there is something wrong with the way i am writing the when clauses but i dont know what it wrong?</p>
  
  <p>(I know i'm using shell here and not a docker module)</p>
  
  <p>My hosts:</p>
  
  <pre><code>[monitorrpihosts]
  host1
  
  [monitorrpihosts:vars]
  ansible_connection=ssh
  ansible_ssh_user=someusername
  highThresholdTrigger=70
  highThresholdReset=40
  </code></pre>
  
  <p>My playbook:</p>
  
  <pre><code>---
  - name: Monitor rpi
    hosts: monitorrpihosts
    become: yes
    become_user: root
    become_method: sudo
  
    roles:
     - monitorrpi
  </code></pre>
  
  <p>My role:</p>
  
  <pre><code>---
  - name: Get current cpu temp
    shell: '/opt/vc/bin/vcgencmd measure_temp | grep ^temp= | cut -d= -f2 | cut -d\. -f1'
    register: cpu_temp
  
  - name: check if boinc is running
    shell: 'docker ps | grep boinc_universeathome | grep -v Paused'
    ignore_errors: True
    register: boinc_running
  
  - name: pause boinc if cpu temp gt highThreshold
    shell: 'docker pause boinc_universeathome'
    when:
      - cpu_temp.stdout_lines|int &gt; highThresholdTrigger|int
      - boinc_running.rc|int == 0
  </code></pre>