Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Fix RedHat install - until condition was not correct #423

Conversation

eRadical
Copy link
Contributor

I was getting

fatal: [redacted_hostname]: FAILED! => {"attempts": 5, "changed": false, "failed": true, "msg": "", "rc": 0, "results": ["elasticsearch-6.2.1-1.noarch providing elasticsearch is already installed"]}

because „failed” was all the time present in the response.

@elasticmachine
Copy link
Collaborator

Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually?

@Crazybus
Copy link
Contributor

jenkins test this please

@@ -19,7 +19,7 @@
when: es_use_repository
register: redhat_elasticsearch_install_from_repo
notify: restart elasticsearch
until: '"failed" not in redhat_elasticsearch_install_from_repo'
until: not redhat_elasticsearch_install_from_repo.failed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work for you?

For me locally and the jenkins job fails consistently with

18:44:52        TASK [elasticsearch : RedHat - Install Elasticsearch] **************************
18:45:02        fatal: [localhost]: FAILED! => {"msg": "The conditional check 'not redhat_elasticsearch_install_from_repo.failed' failed. The error was: error while evaluating conditional (not redhat_elasticsearch_install_from_repo.failed): 'dict object' has no attribute 'failed'"}

It seems to be failing because the "failed" result doesn't exist until the task has finished. I just tried until: redhat_elasticsearch_install_from_repo.rc == 1 and it seems to work as expected.

image

@eRadical
Copy link
Contributor Author

eRadical commented Feb 21, 2018

Indeed it does not work for new machines.

On the machine I initially tried it worked... but Ansible ran there many times.

Though I was wondering what is the rationale behind using until?
If the installation fails the first time and N-1 times why might it succeed in the N-th ?
Can we just drop it?

@Crazybus
Copy link
Contributor

Though I was wondering what is the rationale behind using until?
If the installation fails the first time and N-1 times why might it succeed in the N-th ?

Here is the commit where it was added e3c71a7f .

My best guess would be that it was added to retry for any network connection errors. I can imagine it is pretty annoying if you are deploying a massive 100+ node cluster and a single node fails because of a network error with yum.

Can we just drop it?

Given the huge amount of different users and use-cases for this playbook I would rather leave it in unless there is a really compelling reason to remove it. I don't feel like this adds any extra complexity or maintenance to the playbook. Removing it could only cause some users to have connecting issues during yum installs.

Were you able to test if until: redhat_elasticsearch_install_from_repo.rc == 0 works properly for you?

@eRadical
Copy link
Contributor Author

eRadical commented Feb 22, 2018

Ok, pretty valid points.

Yes, w/ the change it is ok.
Tested on an already present machine and a new machine.

[It still fails but because of #426 .]

@Crazybus
Copy link
Contributor

Just fixed 6.2 support with #431 If you rebase on master you should be able to test properly now.

safchain added a commit to safchain/skydive that referenced this pull request Apr 18, 2018
safchain added a commit to safchain/skydive that referenced this pull request Apr 18, 2018
@Zauxst
Copy link

Zauxst commented Apr 19, 2018

Got this issue when installing ElasticSearch-5.5.3 on CentOS 7, (+ had to also enable the repo "base") on the server for BitBucket Datacenter.

Fixed with until: redhat_elasticsearch_install_from_repo.rc == 0

@Dagon-
Copy link

Dagon- commented May 1, 2018

Hit this while installing 6.2.4 with ansible 2.5.2.
The workarounds already noted worked.

safchain added a commit to safchain/skydive that referenced this pull request May 2, 2018
safchain added a commit to safchain/skydive that referenced this pull request May 3, 2018
safchain added a commit to safchain/skydive that referenced this pull request May 3, 2018
safchain added a commit to safchain/skydive that referenced this pull request May 4, 2018
@Crazybus
Copy link
Contributor

Crazybus commented May 7, 2018

jenkins test this please

@Crazybus Crazybus merged commit 0179bd1 into elastic:master May 8, 2018
@Crazybus
Copy link
Contributor

Crazybus commented May 8, 2018

All tests are passing now!

Thanks for this @eRadical!

@eRadical eRadical deleted the fix-redhat-install-elasticsearch-until-condition branch May 8, 2018 09:49
hunchback pushed a commit to hunchback/skydive that referenced this pull request May 16, 2018
nschlemm added a commit to nschlemm/ansible-elasticsearch that referenced this pull request Sep 11, 2018
nschlemm added a commit to nschlemm/ansible-elasticsearch that referenced this pull request Sep 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants