Yaml is easily converted to some sort of structure, you are mostly dealing with dicts or lists, so in your case you can set complex_args to;
`
$complex_args = @{
add_children = @(
@{
name = “Ansible Brew”
type = “light”
}
)
}
`
As you can see we are setting the key add_children which is a list of dictionary values. In Python a list is expressed in the form of @(“entry”, “another_entry”) while dictionaries are expressed in the form or @{key = “value”; key2 = “value2”}. You can mix and match all these but once you understand how to convert Ansible to lists and dicts you should be good.
Depending on your version of the Legacy module_utils, Get-AnsibleParams just tries to convert the input source to the one that is expected, for a list, it will convert a string by splitting it by , but for existing lists it should just return that value as is.
still I wasn’t able to reproduce the structure to work when debugging PS modules outside of ansible. I came up with a solution about using Export-Clixml, this is about executing the desired parameters and dumping them to disk as a PS xml object.
After all it can be re-loaded outside of Ansible context to understand how parameters are managed under the hood.