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