shell

11 views
Skip to first unread message

Manish Kumar

unread,
Sep 9, 2019, 7:13:09 AM9/9/19
to Ansible Project
Hi,

Please help me with this error which I am getting below :

play-book:

---
- name: Directory creation with current date
  hosts: local
  user: manish
  sudo: yes

  tasks:

  - name: Ansible fact - ansible_date_time
     shell: date.sh
     args:
       chdir: /home/manish/mk/ansible/linux/

Error: 

ERROR! Syntax Error while loading YAML.
  mapping values are not allowed in this context

The error appears to be in '/home/manish/mk/ansible/linux/main.yml': line 10, column 11, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - name: Ansible fact - ansible_date_time
     shell: date.sh
          ^ here

Sebastian Meyer

unread,
Sep 9, 2019, 7:49:57 AM9/9/19
to ansible...@googlegroups.com
On 09.09.19 13:13, Manish Kumar wrote:
> Hi,
>
> Please help me with this error which I am getting below :
>
> play-book:
>
> ---
> - name: Directory creation with current date
> hosts: local
> user: manish
> sudo: yes
>
> tasks:
>
> - name: Ansible fact - ansible_date_time
> shell: date.sh
> args:
> chdir: /home/manish/mk/ansible/linux/
>
> Error:
>
> ERROR! Syntax Error while loading YAML.
> mapping values are not allowed in this context

Your indentation is incorrect. The last three lines need 2 spaces less
indentation each.

Sebastian

>
> The error appears to be in '/home/manish/mk/ansible/linux/main.yml': line
> 10, column 11, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> - name: Ansible fact - ansible_date_time
> shell: date.sh
> ^ here
>

--
Sebastian Meyer
Linux Consultant & Trainer
Mail: me...@b1-systems.de

B1 Systems GmbH
Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de
GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537

Stefan Hornburg (Racke)

unread,
Sep 9, 2019, 7:51:49 AM9/9/19
to ansible...@googlegroups.com
Fix your indentation, it should look like that:

- name: Ansible fact - ansible_date_time
shell: date.sh
args:
chdir: /home/manish/mk/ansible/linux/

It really doesn't hurt to thoroughly read the error message and look at the documentation basics.

Regards
Racke

>
> --
> 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 <mailto:ansible-proje...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4cfc2c01-862f-4768-97fd-331c4c5cce97%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4cfc2c01-862f-4768-97fd-331c4c5cce97%40googlegroups.com?utm_medium=email&utm_source=footer>.


--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

signature.asc
Reply all
Reply to author
Forward
0 new messages