As @kai mentioned. Your indentation is off. Here is a workable playbook for 
you https://gist.github.com/mrlesmithjr/039a7bccf342e456dc6f9cbb2474c995

On Thursday, December 7, 2017 at 1:30:27 PM UTC-5, Bhautik K wrote:
>
> Hi Smith,
>
> Tried making space but still same error.
>
>
> Regards,
> Bhautik
>
> On Thu, Dec 7, 2017 at 9:53 PM, Larry Smith <mrles...@gmail.com 
> <javascript:>> wrote:
>
>> change:
>> msg:"Path exists and is a directory"
>>
>> to:
>> msg: "Path exists and is a directory"
>>
>> Missing space...
>>
>>
>> On Thursday, December 7, 2017 at 9:56:34 AM UTC-5, Bhautik K wrote:
>>>
>>> Looking for solution. I have write below yml for *if directory is 
>>> exists or not* but getting below error. Could you please correct me 
>>> where I did mistake ?
>>>
>>>  
>>>
>>> - hosts: compute
>>>
>>>   tasks:
>>>
>>>   - name: Ansible check directory exists.
>>>
>>>     stat:
>>>
>>>       path=/etc/yum.repos.d
>>>
>>>     register: p
>>>
>>>    - debug:
>>>
>>>        msg:"Path exists and is a directory"
>>>
>>>      when: p.stat.isdir is defined and p.stat.isdir
>>>
>>>  
>>>
>>> -----------------------------
>>>
>>> ERROR! Syntax Error while loading YAML.
>>>
>>>  
>>>
>>>  
>>>
>>> The error appears to have been in '/etc/ansible/postchecklist.yml': line 
>>> 7, column 4, but may
>>>
>>> be elsewhere in the file depending on the exact syntax problem.
>>>
>>>  
>>>
>>> The offending line appears to be:
>>>
>>>  
>>>
>>>     register: p
>>>
>>>    - debug:
>>>
>>>    ^ here
>>>
>>> -- 
>>> Thanks & Regards,
>>> Bhautik Karkar 
>>> 9920343224
>>>
>> -- 
>> 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 ansible-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/91e04a50-7814-4155-806c-09e2edd1435c%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/91e04a50-7814-4155-806c-09e2edd1435c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Thanks & Regards,
> Bhautik Karkar 
> 9920343224
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c6439a04-336e-4433-bea0-c24f65957f0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to