Hi,

I'm trying to set optional values only if they are specified for the "user" 
module.

So with:

- name: Add users
  user:
    name: "{{ item.username }}"
    comment: "{{ item.comment }}"
    state: present
    shell: "{{ (item.shell) | default('/bin/bash') }}"
    password: "{{ item.password }}"
    update_password: always
  with_items: "{{ merged_users }}"
  tags: users

I only have to add an optional shell variable with anotehr value such as 
'/bin/ksh' to override the default bash value.

How can I do the same for:

    home: "{{ item.home }}"
    group: "{{ item.group }}"
    groups: "{{ item.groups }}"

As the home directory defaults to '/home/username', group defaults to 
'username' and groups also defaults to 'username'.

I've tried something like:

    group: "{{ (item.group) | default('/bin/bash') }}"

but no joy.

So please help with these 3 values - how do I define defaults for "home", 
"group" and "groups"?

Regards,
Suhail.

-- 
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/5e68c09e-9473-481f-942b-7fbaee9de3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to