From d3cfac4ac8bc0cea90e56302b5b157790420e231 Mon Sep 17 00:00:00 2001 From: Alessandro Fael Garcia Date: Wed, 26 May 2021 17:56:36 +0200 Subject: [PATCH] Update the URL used to fetch the latest NGINX source version (#411) --- CHANGELOG.md | 4 ++++ tasks/opensource/install-source.yml | 25 +++++-------------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23383ba..196af55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ BREAKING CHANGES: * The NGINX Plus repository has been updated. This might cause some issues when running the role on an instance that already has NGINX Plus installed. **Starting with NGINX Plus R25, you will need to install NGINX Plus using release `0.20.0`. If you are trying to install R23, please use release `0.19.2`. NGINX Plus R24 should work with both release `0.19.2` and `0.20.0`.** * The NGINX Plus modsecurity module is no longer supported by this role. Until NGINX Plus R25 is released, you might keep using release `0.19.2` if you wish to install modsecurity. +BUG FIXES: + +Change the url used to grep the latest NGINX version when installing from source. This should avoid the source install failing whenever the `stable` release is higher than the latest `mainline`. + ## 0.19.2 (April 28, 2021) FEATURES: diff --git a/tasks/opensource/install-source.yml b/tasks/opensource/install-source.yml index af2cf8d..d2783a1 100644 --- a/tasks/opensource/install-source.yml +++ b/tasks/opensource/install-source.yml @@ -283,31 +283,16 @@ block: - name: Fetch NGINX version uri: - url: https://trac.nginx.org/nginx/browser + url: https://version.nginx.com/nginx/{{ nginx_branch }} return_content: yes validate_certs: "{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}" check_mode: no register: nginx_versions - - name: Set NGINX mainline version + - name: Set NGINX version set_fact: - nginx_version: "{{ nginx_versions.content | regex_search('release[^<]*') | regex_replace('release', 'nginx') }}" - when: nginx_branch == "mainline" - - - name: Set NGINX stable version 1/2 - set_fact: - nginx_version: "{{ nginx_versions.content | regex_search('stable[^<]*') | regex_replace('stable', 'release') }}" - when: nginx_branch == "stable" - - - name: Set NGINX stable version 2/2 - set_fact: - nginx_version: "{{ nginx_versions.content | regex_search(nginx_version + '[^<]*') | regex_replace('release', 'nginx') }}" - when: nginx_branch == "stable" - - - name: Set NGINX download filename - set_fact: - nginx_download_name: "{{ nginx_version }}" + nginx_version: "{{ 'nginx-' + (nginx_versions.content | regex_search('([0-9]+\\.){2}[0-9]+')) }}" - name: Check for NGINX install stat: @@ -323,8 +308,8 @@ block: - name: Download NGINX get_url: - url: "https://nginx.org/download/{{ nginx_download_name }}.tar.gz" - dest: "/tmp/{{ nginx_download_name }}.tar.gz" + url: "https://nginx.org/download/{{ nginx_version }}.tar.gz" + dest: "/tmp/{{ nginx_version }}.tar.gz" mode: 0600 validate_certs: "{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '==')) | ternary('no', 'yes') }}"