This seems to have sorted it! lib_dir_version: "{{ (version_no == '12')|ternary('12','11') }}"
single quoted the value '12' Brian Thanks for the heads up - Pointed me properly in the right direction Thank you! Chris On Friday, 2 October 2015 08:46:36 UTC+1, Chris Kerr wrote: > > Thanks for the response Brian > > So far I have changed the syntax to the following: (Had to wrap the > version_no == 12 in ( ) to supress `False` passing through. > > lib_dir_version: "{{ (version_no == 12)| ternary('12','11') }}" > > > If I enter 11 in my prompt - I get the expected echo of > echo "My lib dir version is 11." > > > However when I rerun the playbook, and specify 12 as the version number in > my prompt, I still get Version 11 in the output. > echo "My lib dir version is 11." > > > > > Kind Regards > Chris > > > On Friday, 2 October 2015 00:23:18 UTC+1, Brian Coca wrote: >> >> you are misunderstanding the docs, the use of variables IN the >> conditional 'when' not using when to make var assignment conditional, >> for that you can use filters: >> >> vars: >> lib_dir_version: "{{ version_no == 12|ternary(12, 11) }}" >> >> >> >> -- >> Brian Coca >> > -- 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 ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/3b5bbfc9-7658-4d58-a6b1-c9881c702166%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.