Newbie and seeing error on running yaml file to create switch config

429 views
Skip to first unread message

ansnew...@gmail.com

unread,
Jun 12, 2016, 10:46:22 PM6/12/16
to Ansible Project
Hi ,
I am a newbie to the ansible world and struggling with some errors  I am trying to create switch configs based on the following url:

https://pynet.twb-tech.com/blog/ansible/ansible-cfg-template.html

Whenever, I am running my yaml file, I see the following error:

ERROR! conflicting action statements

The error appears to have been in '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
  - name: Generate tor files
    ^ here


The error appears to have been in '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
  - name: Generate tor files
    ^ here


The file main.yml has the following contents:

---
  - name: Generate tor files
    template: src=tor.j2 dest="{{ item.hostname }}.txt"
    with_items:
     - hostname: nexus1
     - hostname: nexus2
...

Thanks
GP


Kai Stian Olstad

unread,
Jun 13, 2016, 9:34:29 AM6/13/16
to ansible...@googlegroups.com
On 12. juni 2016 04:22, ansnew...@gmail.com wrote:
> The error appears to have been in
> '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column
> 5, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> ---
> - name: Generate tor files
> ^ here
>
>
> The file main.yml has the following contents:
>
> ---
> - name: Generate tor files
> template: src=tor.j2 dest="{{ item.hostname }}.txt"
> with_items:
> - hostname: nexus1
> - hostname: nexus2

Your indentation is wrong, change it to the following,
---
- name: Generate tor files
template: src=tor.j2 dest="{{ item.hostname }}.txt"
with_items:
- hostname: nexus1
- hostname: nexus2

--
Kai Stian Olstad

ansnew...@gmail.com

unread,
Jun 17, 2016, 12:57:11 AM6/17/16
to Ansible Project

ansnew...@gmail.com

unread,
Jun 17, 2016, 1:04:33 AM6/17/16
to Ansible Project
I still see the same error after correcting the indentation as shown below:

more roles/tor/tasks/main.yml

---
- name: Generate tor files
  template: src=tor.j2 dest="{{ item.hostname }}.txt"
  with_items:
    - hostname: nexus1
    - hostname: nexus2

++++++++++++++++++++
ansible-playbook site.yml
ERROR! conflicting action statements

The error appears to have been in '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column 3, but may

be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Generate tor files
  ^ here


The error appears to have been in '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column 3, but may

be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Generate tor files
  ^ here

Please advise

Best,
GP



On Sunday, June 12, 2016 at 7:46:22 PM UTC-7, ansnew...@gmail.com wrote:

Trond Hindenes

unread,
Jun 17, 2016, 2:45:18 AM6/17/16
to Ansible Project
To help get the indentation right, I rely on Visual Studio Code with the yaml extension https://marketplace.visualstudio.com/items?itemName=djabraham.vscode-yaml-validation

Kai Stian Olstad

unread,
Jun 17, 2016, 10:17:41 AM6/17/16
to ansible...@googlegroups.com
On 17. juni 2016 07:04, ansnew...@gmail.com wrote:
> I still see the same error after correcting the indentation as shown below:
>
> more roles/tor/tasks/main.yml
> ---
> - name: Generate tor files
> template: src=tor.j2 dest="{{ item.hostname }}.txt"
> with_items:
> - hostname: nexus1
> - hostname: nexus2
>
> ++++++++++++++++++++
> ansible-playbook site.yml
> ERROR! conflicting action statements
>
> The error appears to have been in
> '/usr/share/ansible/NXS-TEMPLATE/roles/tor/tasks/main.yml': line 2, column
> 3, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
> ---
> - name: Generate tor files
> ^ here

Since this seams to be correct your problem must be inn another file,
maybe your playbook?

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages