Simple ansible playbook failing


I am trying out the Ansible role simple example to run a 1 node ES cluster on my local machine (Ubuntu 18.04).

I read the instructions here:

I ran:

ansible-galaxy install elastic.elasticsearch,7.8.0

Then I created a file local.yml with content:

    - name: Simple Example
         hosts: localhost
          - role: elastic.elasticsearch
            es_version: 7.8.0

And ran it with:

 ansible-playbook local.yml

All the tasks in the role pass but this fails:

TASK [elastic.elasticsearch : unhold elasticsearch package when switching to a different package type] *******************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The conditional check 'elasticsearch_package.stdout == 'install ok installed'' failed. The error was: error while evaluating conditional (elasticsearch_package.stdout == 'install ok installed'): 'dict object' has no attribute 'stdout'\n\nThe error appears to have been in '/home/sami/.ansible/roles/elastic.elasticsearch/tasks/elasticsearch-Debian.yml': line 20, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n  - name: unhold elasticsearch package when switching to a different package type\n    ^ here\n"}
	to retry, use: --limit @/home/sami/tplmaps/ansible_elastic/local.retry

Changing the ES version to 7.7 or 7.6 doesn't make a difference, I get the same error

I have always written my own (simple) playbooks with tasks before, is this supposed to be executed differently?


Solution: Run it with sudo

Hi @samiujan,

I couldn't reproduce your error using this playbook and ubuntu 18.04.
You shouldn't need to run the playbook with sudo as there is already a become statement for tasks requiring root permissions (example).

What OS are you using?

Hi Julien

I am running this on Ubuntu 18.04 desktop

That's strange I did a few other tests but couldn't reproduce it.
Anyway running it with sudo is also fine as a lot of tasks are requiring root permission.

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