Hi All,

I need help with passing JSON in the shell module in ansible. 

*Playbook - *

- hosts: localhost
  name: refresh asg
  connection: local
  gather_facts: True
  tasks:
  - name: refresh instances
    shell: 'aws autoscaling start-instance-refresh --region=us-east-1 
--auto-scaling-group-name test_asg --preferences '{"InstanceWarmup": 400, 
"MinHealthyPercentage": 50}'

*The error I'm getting is -*

fatal: [localhost]: FAILED! => {"changed": true, "cmd": "aws autoscaling 
start-instance-refresh --region=us-east-1 --auto-scaling-group-name 
Test_Iwo_nodes_Development_zone3 --preferences 
{\"MinHealthyPercentage\":90,\"InstanceWarmup\":180}", "delta": 
"0:00:01.069908", "end": "2022-02-23 08:40:31.459081", "msg": "non-zero 
return code", "rc": 255, "start": "2022-02-23 08:40:30.389173", "stderr": 
"usage: \rNote: AWS CLI version 2, the latest major version of the AWS CLI, 
is now stable and recommended for general use. For more information, see 
the AWS CLI version 2 installation instructions at: 
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n\nusage: 
aws [options] <command> <subcommand> [<subcommand> ...] [parameters]\nTo 
see help text, you can run:\n\n  aws help\n  aws <command> help\n  aws 
<command> <subcommand> help\n\nUnknown options: InstanceWarmup:180", 
"stderr_lines": ["usage: ", "Note: AWS CLI version 2, the latest major 
version of the AWS CLI, is now stable and recommended for general use. For 
more information, see the AWS CLI version 2 installation instructions at: 
https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html";, "", 
"usage: aws [options] <command> <subcommand> [<subcommand> ...] 
[parameters]", "To see help text, you can run:", "", "  aws help", "  aws 
<command> help", "  aws <command> <subcommand> help", "", *"Unknown 
options: InstanceWarmup:180"*], "stdout": "", "stdout_lines": []}

-- 
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/a36daf18-cc83-4e4c-86f0-6539f3f78f64n%40googlegroups.com.

Reply via email to