I want to use the following to create users. I do not want to specify home
explicitly in most cases, and default to /home/{username}... The example
should explain clearer what I'm trying to say:
user: name="{{ item.key }}"
state=present
home="{{ item.value.home | default("/home/{{ item.key }}") }}"
with_dict: users
users:
'jepper':
ensure: 'present'
'postgres':
ensure: 'present'
home: '/var/lib/pgsql'
However, default("/home/{{ item.key }}") is not interpreted inside the
default brackets and I end up with only the wanted result in the user where
home was defined:
jepper:x:1200:1200::/home/{{ item.key }}:/bin/bash
postgres:x:1100:1100::/var/lib/pgsql:/bin/bash
Grateful for suggestions on how to get this right.
--
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/56ac7c44-ae98-47af-90b4-6705e90e82ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.