Passing json in shell module in ansible

Can you confirm that the exact same command (without single quotes around it) actually works from an interactive shell?

I would supply it as a yaml formatted variable to your task and then use the filter combo to_json|quote

At least that’s how I supply crazy complex dicts on aws cli commands and those work

easiest way:

shell: !unsafe aws autoscaling start-instance-refresh
--auto-scaling-group-name Test_Iwo_nodes_Development_zone1
--preferences '{"InstanceWarmup": 400, "MinHealthyPercentage": 50}'

but breaking it down into variables is still a good idea, you only
need `!unsafe` on the 'dictionary looking' parts.