Skip to content

[SP-97] Align yaml types and casting#38

Open
zotabee wants to merge 9 commits into
mainfrom
hotfix/sp-97_yaml_type
Open

[SP-97] Align yaml types and casting#38
zotabee wants to merge 9 commits into
mainfrom
hotfix/sp-97_yaml_type

Conversation

@zotabee

@zotabee zotabee commented May 2, 2026

Copy link
Copy Markdown
Collaborator

This PR should fix issues with casting to wrong data types (int instead of string). It also aligns the default file with the best practices for the YAML data types and a cleaner view.

Should correct this problem on multiple roles:

"Non-string value found for env option. Ambiguous env options must be wrapped in quotes..."
This happens because several roles use PUID: "{{ uid | int }}" which converts to an integer, but Docker env: values must be strings.

As per VS Code copilot input for best practices for YAML types and casting.

And the documentation:

YAML Scalars data types:
https://tutorialreference.com/yaml/datatypes/yaml-scalars
https://yaml-multiline.info/
https://www.networkacademy.io/ccna-automation/data-formats/yaml-data-types

Ansible doc for community.docker.docker_container module:

https://docs.ansible.com/projects/ansible/latest/collections/community/docker/docker_container_module.html
https://docs.ansible.com/projects/ansible/latest/collections/community/docker/docker_container_module.html#parameter-user
https://docs.ansible.com/projects/ansible/latest/collections/community/docker/docker_container_module.html#parameter-env

Parameters:
env : dictionary

Dictionary of key,value pairs.

Values which might be parsed as numbers, booleans or other types by the YAML parser must be quoted (for example "true") in order to avoid data loss.

Please note that if you are passing values in with Jinja2 templates, like "{{ value }}", you need to add | string to prevent Ansible to convert strings such as "true" back to booleans. The correct way is to use "{{ value | string }}".

user : string

@zotabee zotabee requested a review from Pro-Tweaker May 2, 2026 19:19
@zotabee zotabee self-assigned this May 2, 2026
@zotabee zotabee added the bug Something isn't working label May 2, 2026
@zotabee zotabee force-pushed the hotfix/sp-97_yaml_type branch from 70c09aa to e790c99 Compare May 17, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant