.yml is failing with syntax error -- need advise

30 views
Skip to first unread message

Shaikh Abdul

unread,
Nov 13, 2016, 11:28:04 AM11/13/16
to Ansible Project, Shaikh Abdul
Hi Experts,

My export.yml is failing,please correct me


[oracle@node02 ~]$ cat export.yml
---
  - hosts: node02
  vars:
    ORACLE_BASE: /u01/oracle/product
    ORACLE_HOME: /u01/oracle/product/11.2.0
    remote_user: oracle
    sudo_user: root
    sudo: false
    gather_facts: true
  tasks:
  - name: export ORACLE_HOME
  action: shell export ORACLE_HOME={{ ORACLE_HOME }};

********************************************************************************
[oracle@node02 ~]$ ansible-playbook -i hosts -k export.yml
SSH password:
ERROR! Syntax Error while loading YAML.


The error appears to have been in '/home/oracle/export.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  - hosts: node02
  vars:
  ^ here

Regards,
Abdul

Uwe Sauter

unread,
Nov 13, 2016, 11:38:42 AM11/13/16
to ansible...@googlegroups.com
Try the attached Python script.

But probably you just have the wrong number of spaces for indentation.

Try:

---
- hosts: node02
vars:
ORACLE_BASE: /u01/oracle/product
ORACLE_HOME: /u01/oracle/product/11.2.0
remote_user: oracle
sudo_user: root
sudo: false
gather_facts: true
tasks:
- name: export ORACLE_HOME
action: shell export ORACLE_HOME={{ ORACLE_HOME }};


But also be advised that you can specify the environment directly in your playbook. First question in the FAQ
(http://docs.ansible.com/ansible/faq.html)
> --
> 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 post to this group, send email to ansible...@googlegroups.com <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/5e2d2fb4-203b-45a6-9bc6-ef095588abc4%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/5e2d2fb4-203b-45a6-9bc6-ef095588abc4%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.
yaml-validate.py

Shaikh Abdul

unread,
Nov 13, 2016, 12:21:55 PM11/13/16
to Ansible Project, uwe.sa...@gmail.com
Thank You Uwe Sauter.

Yes, it was due to spaces. Thanks again for quick assistance.

Regards,
Abdul

Ali Jabir

unread,
Nov 14, 2016, 10:42:51 AM11/14/16
to ansible...@googlegroups.com, Shaikh Abdul
I believe the problem here is indentation.

- hosts: node02
  vars:
    ORACLE_BASE: /u01/oracle/product
    ORACLE_HOME: /u01/oracle/product/11.2.0
  remote_user: oracle
  sudo_user: root
  sudo: false
  gather_facts: true
  tasks:

-AliJ

--
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+unsubscribe@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/5e2d2fb4-203b-45a6-9bc6-ef095588abc4%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages