Yup. I've also been using 'default'. However, As showed in 'user' module
example, problem is when there's no default value.
ie in the case when certain users need to have supplementary group and some
others do not have supplementary group. (there is no such thing as
'groups=item.group | default(none)').

Well, I guess thats the limitation in Ansible and should just accept it
until they developers come out with new modules/mechanism. (It's a great
product anyway!)

Thanks.


On Mon, Jan 13, 2014 at 1:29 PM, Michael DeHaan <mich...@ansibleworks.com>wrote:

> You should probably consider the |default feature in Jinja2 for fields you
> don't want to define a value for, and as Adam said, specify the UUID.
>
> This should take care of the above concerns.
>
> {{ item.shell | default('/bin/sh') }}
>
> etc
>
>
>
>
>
>
> On Sun, Jan 12, 2014 at 11:56 PM, hafizh <hafizh...@gmail.com> wrote:
>
>> Thanks for the reply but I think you guys are missing the point.
>>
>> The 'user' module I put is just a simple example showing the use cases.
>> To make it clearer, it can be 'file' module where I just want to backup one
>> file and not the rest, but using the same action for all.
>> Also, I do follow the "Best Practice" and using roles, and hence the
>> whole discussion because of the limited usability.
>>
>> @Michael DeHaan, I'm well aware of the use of 'when' but it makes your
>> tasks tightly coupled with the 'trigger'. You need to cater for all the
>> possibilites.
>> It will just clutter the tasks. Say you need to create many users with
>> the following requirement:
>>  - username, uid, and gid only
>>  - above + supplementary group only
>>  - above + custom shell only
>>  - above + different home only
>>  - above + etc...
>>
>> Then your 'when' condition will become a real sphegetti because Ansible
>> is ran in sequence. (Try to make the 'when' logic for that and you will
>> see).
>> As far as i know they is no module to skip the subsequent tasks when a
>> task is successfull. Off cause you can use 'when' to skip the subsequence
>> but that will just make it even more complicated.
>>
>> Thanks.
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> Michael DeHaan <mich...@ansibleworks.com>
> CTO, AnsibleWorks, Inc.
> http://www.ansibleworks.com/
>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/JD55w43upYE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to