Hello all,

I would like to ask about the sense of the default values of the parameters 
of Ansible modules.

Let me give you an example, let's say there is a module to manage Virtual 
Machines(VM), the module looks for example like this:

  name: myvm
  memory: 1GiB

When you run this module and the VM don't exist it will create it with 1GiB.

Now let's say the 'memory' parameter has default value of 2GiB.

  name: myvm

Now I will run this^ playbook which has removed the 'memory' parameter.
If the 'memory' parameter is idempotent, then the VM should be updated to 
2GiB of memory.
All seems OK.... but...

If I will create a VM like this:

  name: myvm
  cpu: 5
  memory: 4GiB
  cluster: west

And the module has following default values:
memory: 1GIB
cpu: 1
cluster: mycluster

Then when I for example want to update all of my VMs to 8GiB of memory I 
will create folllowing task:

  name: {{ item }}
  memory: 8GiB
  - {{ vms_to_update }}

The module will update the memory to 8GiB and the cpu and cluster to 
default values.

So in such case default values doesn't make sense to me, because it's not 
clear if the user want's to have the value of cpu and cluster updated or 

Is there any best practise for this? What is the correct usage of the 

Thanks a lot,

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

Reply via email to