It appears you may have wrongly mapped the attribute - commands beneath 
the  ios_commands module in task "Run Show Command"

see examples here 
<https://docs.ansible.com/ansible/latest/modules/ios_command_module.html#examples>
 
and pay attention to indentation, the line "tasks" appears to be wrongly 
indented also.

I would try the following:

---

 - name: Run Show Command
   hosts: all
   connection: network_cli
   gather_facts: no

   tasks:
   - name: Gather Fact on all hosts
     ios_facts:

   - name: Run show Command
     ios_commands:
       commands: "show alarm outstanding"

On Tuesday, November 26, 2019 at 10:26:55 PM UTC-5, Richard wrote:
>
> I need help to run write ansible playbook to run show commands on Cisco 
> Starent devices
> And I'm running into some errors
>
> Playbook
>  ---
>
>  - name: Run Show Command
>    hosts: all
>    connection: network_cli
>    gather_facts: no
>
>   tasks:
>     - name: Gather Fact on all hosts
>       ios_facts:
>
>     - name: Run show Command
>       ios_commands:
>              - commands: "show alarm outstanding"
>
>  ---
>
>
> Errror
>
> ansible@denchpw26:~$ sudo nano CiscoCheck_playbook.ymlCSR, -u a
> ansible@denchpw26:~$ clear
> ansible@denchpw26:~$ ansible-playbook -i all, -u ansible -k -e 
> ansible_network_os=ios CiscoCheck_playbook.yml
> SSH password:
>  [WARNING]: Found both group and host with same name: all
>
> ERROR! Syntax Error while loading YAML.
>   mapping values are not allowed in this context
>
> The error appears to have been in '/home/ansible/CiscoCheck_playbook.yml': 
> line 3, column 8, but may
> be elsewhere in the file depending on the exact syntax problem.
>
> The offending line appears to be:
>
>
>  - name: Run Show Command
>        ^ here
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ea2b1e20-0414-4d86-950a-05d31abc6016%40googlegroups.com.

Reply via email to