Set the "changed" value when using the raw module

30 views
Skip to first unread message

Justin Dugan

unread,
Nov 17, 2016, 2:18:04 PM11/17/16
to Ansible Project
Hi all,

I am using the following task in a playbook:

- name: Install .Net 4.6.2
  raw: c:/temp/NDP462-KB3151800-x86-x64-AllOS-ENU.exe /q /norestart
  when: raw_output.stdout | version_compare('394806', '<')
  notify:
    - reboot

Everything works with the exception of the "notify". I'm assuming this is because the "changed" value returned by the raw module is false. Is there a way to force "changed" to be true?

Thanks,

Justin

Matt Davis

unread,
Nov 17, 2016, 2:40:33 PM11/17/16
to Ansible Project
We changed raw in 2.2 to return changed: true for consistency with the other non-idempotent modules (shell/script/command/etc). You can override with changed_when if you're not on 2.2 yet.

Matt Davis

unread,
Nov 17, 2016, 2:42:06 PM11/17/16
to Ansible Project
Though for what you're doing, you should probably use win_chocolatey or win_package, as they'll actually give you idempotency.

Justin Dugan

unread,
Nov 17, 2016, 2:52:23 PM11/17/16
to Ansible Project
Thanks!

I tried win_chocolatey and it works fine on Win2008; however, on Win2012, it was trying to install patches designed for 2008 and are not applicable for 2012. I also looked into win_package; however, this module requires a product_id and on Win2012, .Net 4.6.2 doesn't show up in "Programs and Features." It shows up as a "KB" patch instead via "View installed updates."
Reply all
Reply to author
Forward
0 new messages