|
283 | 283 | block:
|
284 | 284 | - name: Fetch NGINX version
|
285 | 285 | uri:
|
286 |
| - url: https://trac.nginx.org/nginx/browser |
| 286 | + url: https://version.nginx.com/nginx/{{ nginx_branch }} |
287 | 287 | return_content: yes
|
288 | 288 | validate_certs: "{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '=='))
|
289 | 289 | | ternary('no', 'yes') }}"
|
290 | 290 | check_mode: no
|
291 | 291 | register: nginx_versions
|
292 | 292 |
|
293 |
| - - name: Set NGINX mainline version |
| 293 | + - name: Set NGINX version |
294 | 294 | set_fact:
|
295 |
| - nginx_version: "{{ nginx_versions.content | regex_search('release[^<]*') | regex_replace('release', 'nginx') }}" |
296 |
| - when: nginx_branch == "mainline" |
297 |
| - |
298 |
| - - name: Set NGINX stable version 1/2 |
299 |
| - set_fact: |
300 |
| - nginx_version: "{{ nginx_versions.content | regex_search('stable[^<]*') | regex_replace('stable', 'release') }}" |
301 |
| - when: nginx_branch == "stable" |
302 |
| - |
303 |
| - - name: Set NGINX stable version 2/2 |
304 |
| - set_fact: |
305 |
| - nginx_version: "{{ nginx_versions.content | regex_search(nginx_version + '[^<]*') | regex_replace('release', 'nginx') }}" |
306 |
| - when: nginx_branch == "stable" |
307 |
| - |
308 |
| - - name: Set NGINX download filename |
309 |
| - set_fact: |
310 |
| - nginx_download_name: "{{ nginx_version }}" |
| 295 | + nginx_version: "{{ 'nginx-' + (nginx_versions.content | regex_search('([0-9]+\\.){2}[0-9]+')) }}" |
311 | 296 |
|
312 | 297 | - name: Check for NGINX install
|
313 | 298 | stat:
|
|
323 | 308 | block:
|
324 | 309 | - name: Download NGINX
|
325 | 310 | get_url:
|
326 |
| - url: "https://nginx.org/download/{{ nginx_download_name }}.tar.gz" |
327 |
| - dest: "/tmp/{{ nginx_download_name }}.tar.gz" |
| 311 | + url: "https://nginx.org/download/{{ nginx_version }}.tar.gz" |
| 312 | + dest: "/tmp/{{ nginx_version }}.tar.gz" |
328 | 313 | mode: 0600
|
329 | 314 | validate_certs: "{{ (ansible_facts['os_family'] == 'RedHat' and ansible_facts['distribution_major_version'] is version('6', '=='))
|
330 | 315 | | ternary('no', 'yes') }}"
|
|
0 commit comments