Newbie: Error running ansible playbook

101 views
Skip to first unread message

Vishlesh Patel

unread,
Mar 5, 2018, 5:40:45 PM3/5/18
to Ansible Project
- hosts: CSRs
 gather_facts: false
 connection: local

  tasks:
  - name: test show run
    ios_config:
      authorize: yes
      lines:
        - do show run


I have the above simple show_run.yaml ansible playbook. While i run this playbook I am getting this error:
~/central-orchestration/csr-instance-ansible-poc > ansible-playbook show_run.yaml
ERROR! conflicting action statements: ios_config, name

The error appears to have been in '/Users/vishlpa4/central-orchestration/csr-instance-ansible-poc/show_run.yaml': line 6, column 6, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
   - name: test show run
     ^ here


The error appears to have been in '/Users/vishlpa4/central-orchestration/csr-instance-ansible-poc/show_run.yaml': line 6, column 6, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
   - name: test show run
     ^ here

exception type: <class 'ansible.errors.AnsibleParserError'>
exception: conflicting action statements: ios_config, name

The error appears to have been in '/Users/vishlpa4/central-orchestration/csr-instance-ansible-poc/show_run.yaml': line 6, column 6, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
   - name: test show run
     ^ here

~/central-orchestration/csr-instance-ansible-poc >




Am I missing something here ?


Thanks
Vishlesh

Brian Coca

unread,
Mar 5, 2018, 5:44:00 PM3/5/18
to Ansible Project
I suspect that it is invalid YAML at that point, it is very strict
about it's spaces.

--
----------
Brian Coca

Vishlesh Patel

unread,
Mar 5, 2018, 6:23:48 PM3/5/18
to Ansible Project
Hi Brian,

Thanks for the reply. checking it with yaml validation online tool and it does not show any error.

Vishlesh Patel

unread,
Mar 5, 2018, 11:26:58 PM3/5/18
to Ansible Project
Update: 

Figured out an error. 

I was initially getting error of packaging module missing : module_failure for another Ansible module that installs azure VM.


TASK [azure_rm_virtualnetwork] *********************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ImportError: No module named packaging.version
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/var/folders/tx/v8mw27js4vn1rzwr53dxf1y40000gn/T/ansible_Z_Z8rL/ansible_module_azure_rm_virtualnetwork.py\", line 137, in <module>\n    from ansible.module_utils.azure_rm_common import AzureRMModuleBase, CIDR_PATTERN\n  File \"/var/folders/tx/v8mw27js4vn1rzwr53dxf1y40000gn/T/ansible_Z_Z8rL/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\", line 28, in <module>\nImportError: No module named packaging.version\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

To solve it, I pip installed packaging package and update ansible.cfg to point to the dir where packaging is installed by appending that dir to 

library=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

turns out that Ansible installs its own version of python and keeps its own version of site-packages. So I pip installed the package locally into Ansible's verison of python site-packages. 

Any better approach than this to solve this python dependency issues?

Thanks
Vishlesh

Brian Coca

unread,
Mar 6, 2018, 5:30:17 PM3/6/18
to Ansible Project
Ansible does not install it's own version of Python. Ansible DOES has
a dependency on Python 2.6/2.7 or >=3.5, so installing Ansible through
most methods (pip/OS pkgmgr) can install Python, there is no real way
to avoid this if you want a working copy unless you install the
required Python yourself.


--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages