Hi Jon,

The link you provided has worked wonders, I have found 'win_feature' module 
does more than I need.


--
Thank you.

Stephen.

On Friday, 4 October 2019 21:38:16 UTC+1, J Hawkesworth wrote:
>
> Well to get rid the warning, remove the "{{   and }} " from your 'when' 
> clause.  The 'when' directive is a bit different from other places where 
> you use jinja2 expressions as the "{{ and }}" are implicit.  Although this 
> might seem a bit inconsistent, it does result in easier to read tasks.
>
> If you only want to reboot when a reboot is really needed, you are best 
> off converting your scripts into ansible modules.  You can either keep this 
> to yourself or go the extra yards and make a PR to contribute them back to 
> ansible.   Script is great for quick-and-dirty get things done, but proper 
> modules detect the existing state of resources and then return whether or 
> not they are changed.  If you are lucky and powershell gives you a decent 
> way to get at the state, sometimes modules can be pretty small - there are 
> some that are less than 50 lines of code.  Have a look in 
> https://github.com/ansible/ansible/tree/devel/lib/ansible/modules/windows/ 
> plenty of examples to get you started. 
>
> Sometimes its not worth the effort of course.  But if you do create 
> modules and make their parameters described the desired state you need 
> (rather than making them action or command oriented), then you are 
> definitely going with the grain of how ansible is supposed to work and you 
> will gain the benefit of more easily readable playbooks.
>
> Hope this helps,
>
> Jon
>
> On Friday, October 4, 2019 at 11:58:05 AM UTC+1, Stephen Feyrer wrote:
>>
>> Hi,
>>
>> On Friday, 4 October 2019 11:46:27 UTC+1, Stephen Feyrer wrote:
>>>
>>> Hi everyone,
>>>
>>> The goal is to make the host reboot only if the ansible-fact 
>>> 'reboot_pending' is true.  This is achieved but generates a warning, is 
>>> there a better way of doing this?
>>>
>>>  
>> Just to be clear, I don't mean just removing the braces but an 
>> axiomatically more correct way of detecting if the host needs to reboot.
>>
>> Thanks,
>>
>> Stephen.
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fc814c56-7612-4acd-b216-dae1f10bac55%40googlegroups.com.

Reply via email to