cloudscale-ch / ansible-collection-cloudscale

cloudscale.ch Ansible Collection
https://galaxy.ansible.com/cloudscale_ch/cloud
GNU General Public License v3.0
7 stars 3 forks source link

Make ssh_keys a yaml list in documentation and tests #67

Closed ghost closed 2 years ago

resmo commented 2 years ago

LGTM

For clarification:

In docs it is a type=list https://docs.ansible.com/ansible/latest/collections/cloudscale_ch/cloud/server_module.html#parameter-ssh_keys.

The anslble magic does handles it as a "list of one" if only a string is provided, so this is not about a bug fix but a usage improvement.

ghost commented 2 years ago

The problem I stumbled into is when the comment of an SSH key (read from a file, with a lookup), contains a ,. If the value of ssh_keys is a string in YAML, Ansible will parse this string, and split it at any , found. And I can't tell Ansible not to treat the string as "something to be parsed into a list".

Yes, this is documented behavior (https://docs.ansible.com/ansible/latest/reference_appendices/module_utils.html#ansible.module_utils.common.validation.check_type_list), and not a bug, but I would assume others might also trip over this.

That's why I think that the examples should all feature the more verbose, explicit YAML list as the value of ssh_keys.