I have the following steps in a playbook:
- name: check if .net 4.7.1 is installed
script: check_net_version.ps1 "4.7.1"
register: net471result
changed_when: false

- name: Install .Net 4.7.1
win_chocolatey:
name: dotnet4.7.1
register: net471_exit_code
failed_when: net471_exit_code.rc != 0 and net471_exit_code.rc != 3010
when: '"missing" in net471result.stdout'

- name: reboot node if needed
win_reboot:
when: net471_exit_code.rc is defined and net471_exit_code.rc == 3010 and 
allow_reboot is defined and (allow_reboot | bool)




Check if software is missing (using a custom script because some 
weirdness), install if it is.
This has worked fine for us in Ansible 2.3.x which we've been on until now, 
but this fails in 2.5.0. Even if I add a check for making sure the 
"net471_exit_code" var exists altogether, it fails:

"msg": "The conditional check 'net471_exit_code.rc != 0 and 
net471_exit_code.rc != 3010' failed. The error was: error while evaluating 
conditional (net471_exit_code.rc != 0 and net471_exit_code.rc != 3010): 
'dict object' has no attribute 'rc'"

It seems to me that there's some bug in how Ansible evaluates object 
attributes (or dict keys), so that "net471_exit_code.rc is defined" is 
picked up as a "true" instead of a "false".

Anyone able to repro?



-- 
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/0940cdb0-8a8d-4475-af86-b0c9ea0c62b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to