Ansible-elasticsearch running minimum example results in ERROR! no action detected in task

Hello,

Very excited to make use of an elastic-developed ansible role but I'm afraid I am having difficulty running the "simple example". I am very new to Ansible so this could well be a misconfiguration on my part, however I hope someone can find time to help. The resolution of this will hopefully help a lot of other people beginning to look into automating elastic deployments.

Problem is running the playbook results in:
// ERROR! no action detected in task
which leads me to believe something is setup wrong, ansible doesn't find tasks yet they are clearly there in tasks/main.yml

There are also deprecation warnings about include vs include_task and import_task.

steps to reproduce

Clone the ansible-elasticsearch repository (master, planning a latest elasticstack build)

// cd ~/ansible
// git clone https://github.com/elastic/ansible-elasticsearch.git

write the example playbook from the README into

// ~/ansible/playbook.yml

which contains:

---

- name: Simple Example
  hosts: localhost
  roles:
    - { role: elasticsearch, es_instance_name: "node1" }
  vars:

create a roles directory and add a link to the repo root:

// mkdir -p roles
// ln -s ./ansible-elasticsearch ./roles/elasticsearch

so now we have:

ansible/
ansible-elasticsearch/
roles/
elasticsearch
playbook.yml

where roles/elasticsearch is soft linked to ansible-elasticsearch.

My ansible version:
ansible --version
ansible 2.4.3.0
config file = None
configured module search path = [u'/home/masond/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.14 (default, Sep 23 2017, 22:06:14) [GCC 7.2.0]

then run:

// ansible-playbook playbook.yml

and I receive:

 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
 [WARNING]: No inventory was parsed, only implicit localhost is available
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

ERROR! Syntax Error while loading YAML.

The error appears to have been in '/home/masond/ansible/playbook.yml': line 3, column 10, but may

be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
hosts: localhost
roles:
^ here

exception type: <class 'yaml.scanner.ScannerError'>
exception: mapping values are not allowed in this context
  in "<unicode string>", line 3, column 10

upon fixing some indentation errors in playbook.yml, I manage to get:
masond@matey:~/ansible$ ansible-playbook playbook.yml
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source

[WARNING]: No inventory was parsed, only implicit localhost is available

[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

ERROR! the role 'elasticsearch' was not found in /home/masond/ansible/roles:/home/masond/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/home/masond/ansible

The error appears to have been in '/home/masond/ansible/playbook.yml': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

roles:
- { role: elasticsearch, es_instance_name: node1}
^ here

$ ls /home/masond/ansible/roles/
elasticsearch

It seems that ansible isn't able to follow a symbolic link. Providing the full path - as documented as an option here - fixed it though! :slight_smile:

This was going to be a question but running through my repro steps I managed to make some good headway. Hopefully this will help somebody else. I guess my only question is why didn't the symlink work and has anyone else had problems like this?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.