Unable to run playbook (Syntax Error)

47 views
Skip to first unread message

Joshua Hill

unread,
Apr 30, 2018, 5:26:30 PM4/30/18
to Ansible Project
Can someone show me where my mistakes are with the below playbook? When i try to run this playbook it tells me it fails at 

    - name: run multiple commands on remote nodes
      ^ here

---
- name: get version
 hosts: all
 gather_facts: false
 connection: local

  tasks:
   - name: run multiple commands on remote nodes
     ios_command:
       commands:
         - show version
         - show ip int brief

      register: print_output

    -  debug: var=print_output.stdout_lines


Karl Auer

unread,
Apr 30, 2018, 5:35:50 PM4/30/18
to ansible...@googlegroups.com
"hosts" should come before "name". I think.


--
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/28d6edf5-b5de-4241-a5ea-8e586c3b9cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Karl Auer

Email  : ka...@2pisoftware.com
Website: 
http://2pisoftware.com

GPG/PGP : 958A 2647 6C44 D376 3D63 86A5 FFB2 20BC 0257 5816
Previous: F0AB 6C70 A49D 1927 6E05 81E7 AD95 268F 2AB6 40EA

Joshua Hill

unread,
Apr 30, 2018, 5:48:22 PM4/30/18
to Ansible Project
Same issue

Brian Coca

unread,
Apr 30, 2018, 7:13:46 PM4/30/18
to Ansible Project
hosts/name order does not matter, indentation does seem to be off, -
debug should start at same level as the previous task





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

Richard Hector

unread,
Apr 30, 2018, 9:28:17 PM4/30/18
to ansible...@googlegroups.com
I think the 3 lines under "- name" need to be indented level with the 'n'.

Richard

Richard Hector

unread,
Apr 30, 2018, 9:30:05 PM4/30/18
to ansible...@googlegroups.com
On 01/05/18 11:13, Brian Coca wrote:
> hosts/name order does not matter, indentation does seem to be off, -
> debug should start at same level as the previous task

Oh, whoops - I was looking at the wrong '- name'

Richard

Joshua Hill

unread,
May 1, 2018, 12:45:07 AM5/1/18
to Ansible Project
Tried it without the register and still no go!

---
- name: get version
  hosts: all
  gather_facts: false
  connection: local

  tasks:

    - name: run multiple commands on remote nodes
      ios_command:
         commands:
              - show version
              - show ip int brief


On Monday, April 30, 2018 at 5:26:30 PM UTC-4, Joshua Hill wrote:

Brian Coca

unread,
May 1, 2018, 9:44:13 AM5/1/18
to Ansible Project
so from emai (not a good source) the indentations were off in many
places, this is a 'fixed' version of your play:


- name: get version
hosts: all
gather_facts: false
connection: local
tasks:

- name: run multiple commands on remote nodes
ios_command:
commands:
- show version
- show ip int brief
register: print_output

- debug: var=print_output.stdout_lines


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