James pointed out the mistakes in the json and now it works.
I am able to use json as valid format for playboks.

On Wednesday, June 26, 2019 at 7:18:22 PM UTC-4, Michael M wrote:
>
> Playbooks must be in yaml. Inventories can be in json (at least dynamic 
> inventories require it), but not the playbooks themselves.
>
>
> On 6/26/19 3:08 PM, Narahari 'n' Savitha wrote:
>
> Hello Folkds: 
>
> Thank you in advance for your time and attention.
>
> I wrote a playbook in the json format.
>
> [
>>   {
>>     "name": "Test the json mode"
>>     "hosts": "cool_columbus",
>>     "tasks": [
>>       {
>>         "name": "First task"
>>         "shell": {
>>           "chdir": "/tmp",
>>           "free_form": "ls -l",
>>         }
>>       }
>>     ]
>>   }
>> ]
>
>
> when I run it with the command
>
>  ansible-playbook test_playbook.json
>>
>> ERROR! Syntax Error while loading YAML.
>>
>>   expected ',' or '}', but got '<scalar>'
>>
>>
>>> The error appears to have been in '/home/pidansible/test_playbook.json': 
>>> line 4, column 5, but may
>>
>> be elsewhere in the file depending on the exact syntax problem.
>>
>>
>>> The offending line appears to be:
>>
>>
>
> What am I doing wrong and how to run this ?
>
> Please help.
>
> -N 
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/701970c3-3726-4261-aa2f-56ba64370acc%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/ansible-project/701970c3-3726-4261-aa2f-56ba64370acc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c43e5e65-6066-4812-b980-80fa28b5eb55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to