From dbc13da1ed6f0d4840c666ffb72ab606bc6b5e13 Mon Sep 17 00:00:00 2001 From: Olivier Clavel Date: Fri, 24 May 2019 15:04:12 +0200 Subject: [PATCH] Allow to configure the timeout and retries waiting for nexus port --- README.md | 23 ++++++++++++++++++++--- handlers/main.yml | 5 ++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 97c22445..5431deaa 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ _(Created with [gh-md-toc](https://github.com/ekalinin/github-markdown-toc))_ * [Force groovy scripts registration](#force-groovy-scripts-registration) * [Change admin password after first install](#change-admin-password-after-first-install) * [Upgrade nexus to latest version](#upgrade-nexus-to-latest-version) + * [Fix upgrade failing on timeout waiting for nexus port](#fix-upgrade-failing-on-timeout-waiting-for-nexus-port) * [Skip provisionning tasks](#skip-provisionning-tasks) * [Dependencies](#dependencies) * [Example Playbook](#example-playbook) @@ -54,7 +55,7 @@ _(Created with [gh-md-toc](https://github.com/ekalinin/github-markdown-toc))_ * [License](#license) * [Author Information](#author-information) - + @@ -736,10 +737,10 @@ ansible-playbook -i your/inventory.ini your_playbook.yml -e nexus_default_admin_ ```yaml nexus_upgrade: true ``` -**This variable has no effect if nexus_version is fixed in your vars** +**This variable has no effect if `nexus_version` is fixed in your vars** Unless you set this variable, the role will keep the current installed nexus version when running against -an already provisionned host. Passing this extra var will trigger automatic latest nexus version detection and upgrade +an already provisioned host. Passing this extra var will trigger automatic latest nexus version detection and upgrade if a newer version is available. **Setting this var as part of your playbook breaks idempotence** (i.e. your playbook will make changes to your system @@ -750,6 +751,22 @@ We strongly suggest to use this variable only as an extra var to ansible-playboo ansible-playbook -i your/inventory.ini your_playbook.yml -e nexus_upgrade=true ``` +##### Fix upgrade failing on timeout waiting for nexus port +If you have a large nexus repository, you may occasionally see an error message when upgrading +``` +RUNNING HANDLER [nexus3-oss : wait-for-nexus-port] ************* +fatal: [nexushost]: FAILED! => {"changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:8081"} +``` +This is most likely because the nexus upgrade process (i.e. migrating internal orientdb) is taking longer than +the default 300 seconds. You can overcome this situation by setting a custom timeout in seconds to or/and a number of retries +for the handler task. +``` +ansible-playbook -i your/inventory.ini your_playbook.yml \ +-e nexus_upgrade=true \ +-e nexus_wait_for_port_timeout=600 +-e nexus_wait_for_port_retries=2 +``` + #### Skip provisionning tasks ```yaml nexus_run_provisionning: false diff --git a/handlers/main.yml b/handlers/main.yml index 45eeb6a9..3a5f98d5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -25,7 +25,10 @@ - name: wait-for-nexus-port wait_for: port: "{{ nexus_default_port }}" - delay: 5 + timeout: "{{ nexus_wait_for_port_timeout | default(omit) }}" + retries: "{{ nexus_wait_for_port_retries | default(omit) }}" + register: wait_for_result + until: wait_for_result is success - name: httpd-service-reload systemd: