This is the input:
- hostname: rk089-s11
compute: false
control: true
master: false
- hostname: rk090-s11
compute: false
control: true
master: true
I am trying to get this output:
- hostname: rk089-s11
role: control
- hostname: rk090-s11
role: control,master
I tried this:
yq -r '.[] |
[
{
"hostname": .hostname,
"role": (
( ( pute == true ) | "compute," ) +
( ( .control == true ) | "control," ) +
( ( .master == true ) | "master," )
)
}
]'|sed 's/,$//'
but I only got this