Re: [ansible-project] Re: Using defaults for Ansible user module for for "home", "group" and "groups"

2019-03-22 Thread Sebastian Meyer
On 22.03.19 12:26, Suhail Choudhury wrote:
> Sorry I meant I've tried something like:
> 
> group: "{{ (item.group) | default('[]') }}"
> 

Try default(omit), that'd just not set the parameter if item.group isn't
defined.

- Sebastian

> but no joy as Ansible throws the error that "Group "" does not exist".
> 
> If I try
> 
> group: "{{item.group if item.group is defined else item.username }}"
> 
> then Ansible fails with the group does not exist.
> 
> Whereas the default without specifying is that it creates it as the 
> username.
> 

-- 
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

-- 
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/135e0c26-3c4b-6b00-3bfc-4d9da52cf66d%40b1-systems.de.
For more options, visit https://groups.google.com/d/optout.


[ansible-project] Re: Using defaults for Ansible user module for for "home", "group" and "groups"

2019-03-22 Thread Suhail Choudhury
Sorry I meant I've tried something like:

group: "{{ (item.group) | default('[]') }}"

but no joy as Ansible throws the error that "Group "" does not exist".

If I try

group: "{{item.group if item.group is defined else item.username }}"

then Ansible fails with the group does not exist.

Whereas the default without specifying is that it creates it as the 
username.

-- 
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/00992413-997b-48a7-8ea4-401c80ad975d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.