On 27. sep. 2017 21:10, Dave Florek wrote:
Thanks Kai. For some reason, when I run my playbook though, the Ansible
doesn't like how the when: conditional is structured

when: new_user != "root"

This when check if the variable new_user not equal to the string root


*fatal: [192.168.1.5]: FAILED! => {"changed": false, "failed": true,
"invocation": {"module_args": {"name": "dave3", "when": "new_user !=
\"root\""}, "module_name": "user"}, "msg": "unsupported parameter for
module: when"}*

I don't see too many examples where a variable is invoked by when: so, I'm
not sure if the syntax somehow is wrong. I tried specifying it as a list as
well, but that had no effect:


Most when is using variables, and for the Ansible docs about conditional you posted has several (actually all of them has at least one variable)

But you error messages indicate wrong indentation of when.
This would be easier if you showed your code and not just the error, but if you look at the link you posted you'll see when is indentation must be at the same level as the module name.


--
Kai Stian Olstad

--
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/fe5c0a52-2209-a2fe-9d4c-847e03ecaa00%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to