Do you need to do this natively handling the data structure in a playbook
or would a degree of preprocessing be OK?

You might be able set the style using yq as one option? Possibly in
combination with key matching?

https://mikefarah.gitbook.io/yq/operators/style#set-single-quote-style


On Fri, 3 Nov 2023 at 12:57, Dick Visser <[email protected]> wrote:

> Hii,
>
> I have a structure like this:
>
> ---
> state:
>   owner_id: 036001814778
>   environments:
>     - name: prod
>       owner_id: 036001814778
>       foo:
>         bar:
>           - name: xasdf
>             owner_id: 036001814778
>     - name: acc
>       owner_id: 036001814778
>       bar: baz
>       nest:
>         ed:
>           struct:
>             deeper:
>               too:
>                 owner_id: 036001814778
>                 foo: biz
>                 boz: bar
>
> I am looking for a way to have all values for owner_id (no matter what
> level) be strings rather than integers. So the dict would look like:
>
> ---
> state:
>   owner_id: '036001814778'
>   environments:
>     - name: prod
>       owner_id: '036001814778'
>       foo:
>         bar:
>           - name: xasdf
>             owner_id: '036001814778'
>     - name: acc
>       owner_id: '036001814778'
>       bar: baz
>       nest:
>         ed:
>           struct:
>             deeper:
>               too:
>                 owner_id: '036001814778'
>                 foo: biz
>                 boz: bar
>
> The complication here is that the owner_id keys can appear at any level.
>
> Tnx!
>
> Dick
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAF8BbLajtsiYTJtFDqV3-RMHxDrJ83pHdtVW%3Dy%3DkmJ1x%3DeV2SA%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLajtsiYTJtFDqV3-RMHxDrJ83pHdtVW%3Dy%3DkmJ1x%3DeV2SA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKtKohRs3XrgqY%3DPsk3e%3DsHwLcdHoqgxh7GMX%2B1U6NaPuTWRbA%40mail.gmail.com.

Reply via email to