Newbie question on syntax

61 views
Skip to first unread message

Kenny Barnes

unread,
Sep 5, 2017, 2:51:55 PM9/5/17
to Ansible Project
Keep getting an error when running the following playbook.  Copied from gethub and watch youtube running the same w/o error. 

---
- name: Get Existing UCS Information
  hosts: ucs (Runs on UCS group in the inv file)
  connection: local
  gather_facts: no

  tasks:
    - name: Pull WWPNs from UCS
      getucswwpns:
        host={{ inventory_hostname }}
        ucs_user="config"
        ucs_pass="config"
        outputfile=output.txt
        logfile=log.txt


Error:

The offending line appears to be:

  tasks:
    - name: Pull WWPNs from UCS
      ^ here


Any help appreciated. 

Sieds Pallas

unread,
Sep 5, 2017, 3:24:38 PM9/5/17
to Ansible Project


Op dinsdag 5 september 2017 20:51:55 UTC+2 schreef Kenny Barnes:
Keep getting an error when running the following playbook.  Copied from gethub and watch youtube running the same w/o error. 

Error:

The offending line appears to be:

  tasks:
    - name: Pull WWPNs from UCS
      ^ here
 
Indentation?
I think the dash needs to align with the t of task
 

Kenny Barnes

unread,
Sep 5, 2017, 4:26:33 PM9/5/17
to Ansible Project
Thanks but I moved like so and now get another error.

 tasks:
  - name: Pull WWPNs from UCS
     getucswwpns:
       host={{ inventory_hostname }}
       ucs_user="config"
       ucs_pass="config"
       outputfile=output.txt
       logfile=log.txt


The offending line appears to be:

  - name: Pull WWPNs from UCS
     getucswwpns:
                          ^ here

Jean-Yves LENHOF

unread,
Sep 5, 2017, 4:41:52 PM9/5/17
to ansible...@googlegroups.com


Le 05/09/2017 à 22:26, Kenny Barnes a écrit :
> Thanks but I moved like so and now get another error.
>
> tasks:
> - name: Pull WWPNs from UCS
> getucswwpns:
> host={{ inventory_hostname }}
> ucs_user="config"
> ucs_pass="config"
> outputfile=output.txt
> logfile=log.txt
>
>
> The offending line appears to be:
>
> - name: Pull WWPNs from UCS
> getucswwpns:
> ^ here

Hi,

All your problems lies to some wrong indentation...

Please read :
http://docs.ansible.com/ansible/latest/YAMLSyntax.html
and
http://docs.ansible.com/ansible/latest/playbooks_roles.html#task-versus-play-includes

in your last error, getucswwpns need to be aligned to name...

Regards,

JYL

Kenny Barnes

unread,
Sep 6, 2017, 9:18:10 PM9/6/17
to ansible...@googlegroups.com
I have moved the alignment every way possible it seams.  Will continue to read...


--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/CAyFe8IZgP4/unsubscribe.
To unsubscribe from this group and all its topics, 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/abf849c1-1247-c70f-b424-67e4a0ba1bab%40lenhof.eu.org.
For more options, visit https://groups.google.com/d/optout.

Jean-Yves LENHOF

unread,
Sep 7, 2017, 5:42:39 AM9/7/17
to ansible...@googlegroups.com
There's also a problem with ":" and "="

If you put arguments on multiple lines you need to use ":" and not "="...  (preferred way for readability)

Documentation about it here : http://docs.ansible.com/ansible/latest/playbooks_intro.html#playbook-language-example

If you put arguments on the same line than your module you need to use "="

Regards,

JYL

Kai Stian Olstad

unread,
Sep 7, 2017, 9:24:56 AM9/7/17
to ansible...@googlegroups.com
The problem is that you have not shown you complete error message, the
part you have is not relevant at all.
If you look at you output is also say something like "the error might be
else in the file".

If you had provided the completa error message you probably would had a
answer much sooner.
But my guess is that your problem is the hosts: line, remove the
parentheses and the text between.

--
Kai Stian Olstad

Kenny Barnes

unread,
Sep 7, 2017, 10:55:04 AM9/7/17
to Ansible Project
Not sure what you mean my removing the parentheses and text between.  Doesn't that equal blank??
This is my complete yml file>
---
- name: Get Existing UCS Information
  hosts: ucs
  connection: local
  gather_facts: no

  tasks:
    - name: Pull WWPNs from UCS
      getucswwpns:
        hosts= {{ inventory_hostname }}
        ucs_usercwcw="config"
        ucs_passcwcw="config"
        outputfilecw=output.txt
        logfile=log.txt

This is the complete error msg. 
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/etc/ansible/ucs/autozone.yml': line 8, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Pull WWPNs from UCS
      ^ here


The error appears to have been in '/etc/ansible/ucs/autozone.yml': line 8, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  tasks:
    - name: Pull WWPNs from UCS
      ^ here

Kai Stian Olstad

unread,
Sep 7, 2017, 11:43:15 AM9/7/17
to ansible...@googlegroups.com
On torsdag 7. september 2017 16.55.04 CEST Kenny Barnes wrote:
> Not sure what you mean my removing the parentheses and text between.
> Doesn't that equal blank??
> This is my complete yml file>
> ---
> - name: Get Existing UCS Information
> hosts: ucs
> connection: local
> gather_facts: no

In you initial mail you had this
hosts: ucs (Runs on UCS group in the inv file)

So if you had this in you playbook it would fail and the reason for my
comment.


> tasks:
> - name: Pull WWPNs from UCS
> getucswwpns:
> hosts= {{ inventory_hostname }}
> ucs_usercwcw="config"
> ucs_passcwcw="config"
> outputfilecw=output.txt
> logfile=log.txt
>
> This is the complete error msg.
> ERROR! no action detected in task. This often indicates a misspelled module
> name, or incorrect module path.

This is the essential error message, your module getucswwpns doesn't exist.
getucswwpns is not part of Ansible so you would need to install it.


--
Kai Stian Olstad

Kenny Barnes

unread,
Sep 13, 2017, 2:42:02 PM9/13/17
to ansible...@googlegroups.com
I did not add the getucswwpns module, and good to know it has to be.  Thanks for the input.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/CAyFe8IZgP4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages