File tree Expand file tree Collapse file tree 9 files changed +91
-16
lines changed Expand file tree Collapse file tree 9 files changed +91
-16
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,13 @@ ENHANCEMENTS:
1414* Add support for PCRE 2 and OpenSSL 3.0 (built from source) when building NGINX from source.
1515* Tweak Release Drafter config.
1616* Bump the Ansible ` community.general ` collection to ` 5.1.1 ` , ` ansible.posix ` collection to ` 1.4.0 ` and ` community.docker ` collection to ` 2.6.0 ` .
17+ * Re-add Alpine Linux tests to ` downgrade ` Molecule scenarios.
1718
1819BUG FIXES:
1920
2021* Ensure gpg-agent is installed on Ubuntu/Debian to avoid APT key tasks failures.
2122* Always refresh the ` yum ` cache.
23+ * The role can now correctly upgrade NGINX to the latest release on Alpine Linux.
2224
2325## 0.23.1 (April 6, 2022)
2426
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ nginx_start: true
2525# Specify whether you want to install NGINX, upgrade to the latest version, or remove NGINX.
2626# Can be used with `nginx_version` to fine tune control which version of NGINX is installed/used on each playbook execution.
2727# Using 'install' will install the latest version (or 'nginx_version') of NGINX on a fresh install.
28- # Using 'upgrade' will upgrade NGINX to the latest version (that matches your 'nginx_version') of NGINX on every playbook execution. Does not work on Alpine Linux.
28+ # Using 'upgrade' will upgrade NGINX to the latest version (that matches your 'nginx_version') of NGINX on every playbook execution.
2929# Using 'uninstall' will remove NGINX from your system.
3030# Default is install.
3131nginx_setup : install
Original file line number Diff line number Diff line change 22- name : Converge
33 hosts : all
44 pre_tasks :
5+ - name : Set repo if Alpine
6+ ansible.builtin.set_fact :
7+ version : " =1.21.6-r1"
8+ when : ansible_facts['os_family'] == "Alpine"
59 - name : Set repo if Debian
610 ansible.builtin.set_fact :
7- version : " =1.22.0 -1~{{ ansible_facts['distribution_release'] }}"
11+ version : " =1.21.6 -1~{{ ansible_facts['distribution_release'] }}"
812 when : ansible_facts['os_family'] == "Debian"
913 - name : Set repo if Red Hat
1014 ansible.builtin.set_fact :
11- version : " -1.22.0 -1.{{ (ansible_facts['distribution'] == 'Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
15+ version : " -1.21.6 -1.{{ (ansible_facts['distribution'] == 'Amazon') | ternary('amzn2', ('el' + ansible_facts['distribution_major_version'] | string)) }}.ngx"
1216 when : ansible_facts['os_family'] == "RedHat"
1317 tasks :
1418 - name : Install NGINX
1519 ansible.builtin.include_role :
1620 name : ansible-role-nginx
1721 vars :
1822 nginx_version : " {{ version }}"
19- nginx_branch : stable
Original file line number Diff line number Diff line change 66 yamllint .
77 ansible-lint --force-color
88platforms :
9+ - name : alpine-3.13
10+ image : alpine:3.13
11+ dockerfile : ../common/Dockerfile.j2
12+ privileged : true
13+ volumes :
14+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
15+ command : " /sbin/init"
16+ - name : alpine-3.14
17+ image : alpine:3.14
18+ dockerfile : ../common/Dockerfile.j2
19+ privileged : true
20+ volumes :
21+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
22+ command : " /sbin/init"
23+ - name : alpine-3.15
24+ image : alpine:3.15
25+ dockerfile : ../common/Dockerfile.j2
26+ privileged : true
27+ volumes :
28+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
29+ command : " /sbin/init"
30+ - name : alpine-3.16
31+ image : alpine:3.16
32+ dockerfile : ../common/Dockerfile.j2
33+ privileged : true
34+ volumes :
35+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
36+ command : " /sbin/init"
937 - name : amazonlinux-2
1038 image : amazonlinux:2
1139 dockerfile : ../common/Dockerfile.j2
Original file line number Diff line number Diff line change 22- name : Prepare
33 hosts : all
44 pre_tasks :
5+ - name : Set repo if Alpine
6+ ansible.builtin.set_fact :
7+ version : " =1.23.0-r1"
8+ when : ansible_facts['os_family'] == "Alpine"
59 - name : Set repo if Debian
610 ansible.builtin.set_fact :
711 version : " =1.23.0-1~{{ ansible_facts['distribution_release'] }}"
Original file line number Diff line number Diff line change 2424 url : http://localhost
2525 status_code : 200
2626
27- - name : Fetch NGINX version
28- ansible.builtin.uri :
29- url : https://version.nginx.com/nginx/stable
30- return_content : true
31- check_mode : false
32- register : nginx_versions
33-
34- - name : Set NGINX version
35- ansible.builtin.set_fact :
36- nginx_version : " {{ nginx_versions.content | regex_search('([0-9]+\\ .){2}[0-9]+') }}"
37-
3827 - name : Verify NGINX has been downgraded
3928 ansible.builtin.command : nginx -v
4029 args :
4130 chdir : " {{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
4231 changed_when : false
4332 register : version
44- failed_when : version is not search(nginx_version )
33+ failed_when : version is not search('1.21.6' )
Original file line number Diff line number Diff line change 66 yamllint .
77 ansible-lint --force-color
88platforms :
9+ - name : alpine-3.13
10+ image : alpine:3.13
11+ dockerfile : ../common/Dockerfile.j2
12+ privileged : true
13+ volumes :
14+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
15+ command : " /sbin/init"
16+ - name : alpine-3.14
17+ image : alpine:3.14
18+ dockerfile : ../common/Dockerfile.j2
19+ privileged : true
20+ volumes :
21+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
22+ command : " /sbin/init"
23+ - name : alpine-3.15
24+ image : alpine:3.15
25+ dockerfile : ../common/Dockerfile.j2
26+ privileged : true
27+ volumes :
28+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
29+ command : " /sbin/init"
30+ - name : alpine-3.16
31+ image : alpine:3.16
32+ dockerfile : ../common/Dockerfile.j2
33+ privileged : true
34+ volumes :
35+ - " /sys/fs/cgroup:/sys/fs/cgroup:rw"
36+ command : " /sbin/init"
937 - name : amazonlinux-2
1038 image : amazonlinux:2
1139 dockerfile : ../common/Dockerfile.j2
Original file line number Diff line number Diff line change 22- name : Prepare
33 hosts : all
44 pre_tasks :
5+ - name : Set repo if Alpine
6+ ansible.builtin.set_fact :
7+ version : " =1.21.6-r1"
8+ when : ansible_facts['os_family'] == "Alpine"
59 - name : Set repo if Debian
610 ansible.builtin.set_fact :
711 version : " =1.21.6-1~{{ ansible_facts['distribution_release'] }}"
Original file line number Diff line number Diff line change 1313 state : " {{ nginx_state }}"
1414 update_cache : true
1515 ignore_errors : " {{ ansible_check_mode }}"
16+ when : not (nginx_setup == 'upgrade' and nginx_version is not defined)
1617 notify : (Handler) Run NGINX
18+
19+ - name : (Alpine Linux) Upgrade NGINX workaround ('nginx_setup' is set to 'upgrade' and 'nginx_version' is not defined)
20+ block :
21+ - name : (Alpine Linux) Check if there are NGINX upgrades available
22+ ansible.builtin.command : apk list --upgrade
23+ register : upgrade
24+ changed_when : false
25+
26+ - name : (Alpine Linux) Upgrade NGINX
27+ ansible.builtin.command : apk add --upgrade nginx{{ nginx_repository is not defined | ternary('@nginx', '') }}
28+ changed_when : upgrade.stdout is search('nginx')
29+ when : upgrade.stdout is search('nginx')
30+ notify : (Handler) Run NGINX
31+ when :
32+ - nginx_setup == 'upgrade'
33+ - nginx_version is not defined
You can’t perform that action at this time.
0 commit comments