My playbook:
-
name: Get Java version
shell: /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version 2>&1 | grep ‘^java’ | cut -d’"’ -f2
register: jre_ver -
debug: msg=“{{ jre_ver.stdout }}”
-
name: Install JRE 8 if necessary
include: jre8.yml
when: jre_ver.stdout != ‘1.8.0_25’
ignore_errors: true
Result:
GATHERING FACTS ***************************************************************
ok: [eisbock]
TASK: [Get Java version] ******************************************************
changed: [eisbock]
TASK: [debug msg=“{{ jre_ver.stdout }}”] **************************************
ok: [eisbock] => {
“msg”: “1.8.0_25”
}
TASK: [Copy JRE 8 installer] **************************************************
skipping: [eisbock]
TASK: [Mount disk image] ******************************************************
skipping: [eisbock]
TASK: [Dismount installer] ****************************************************
skipping: [eisbock]
TASK: [Clean up dmg] **********************************************************
skipping: [eisbock]
PLAY RECAP ********************************************************************
eisbock : ok=3 changed=1 unreachable=0 failed=0
Why is ansible still including jre8.yml and skipping each step? I thought it would just not even tough it if the conditional didn’t match.