The highest level at which this can be set is play level.
But I have many plays, so I’d have to edit all those plays and explicitly define them.
I can use a variable for it (I think) but still it’s a lot of extra code.
Is there a way to set this globally, in some (single) configuration/file?
At that point copy the module into a custom one and set the defaults
you want.
that doesn't sound very sustainable, especially if this is the case for
multiple modules in multiple collections.
It might be helpful to allow module defaults to be included instead of
having to re-specify them in every play (include_module_defaults:
my-defaults.yaml).
You'll still have to add that include to all your plays then, but at
least you only have to do it once (and even can use a linting rule to
make sure that all your plays include that default) and have a single
place where to fill these defaults in.
> At that point copy the module into a custom one and set
> the defaults you want.
... allow module defaults to be included instead of
having to re-specify them in every play
(include_module_defaults: my-defaults.yaml).
FWIW, a substitution would solve many use-cases
- hosts: all
module_defaults: "{{ mdefaults }}"
...
Unfortunately, it fails:
ERROR! The field 'module_defaults' is supposed to be a
dictionary or list of dictionaries, the keys of which must
be static action, module, or group names. Only the values
may contain templates. For example: {'ping': "{{
ping_defaults }}"}