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:
14
14
* Add support for PCRE 2 and OpenSSL 3.0 (built from source) when building NGINX from source.
15
15
* Tweak Release Drafter config.
16
16
* 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.
17
18
18
19
BUG FIXES:
19
20
20
21
* Ensure gpg-agent is installed on Ubuntu/Debian to avoid APT key tasks failures.
21
22
* Always refresh the ` yum ` cache.
23
+ * The role can now correctly upgrade NGINX to the latest release on Alpine Linux.
22
24
23
25
## 0.23.1 (April 6, 2022)
24
26
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ nginx_start: true
25
25
# Specify whether you want to install NGINX, upgrade to the latest version, or remove NGINX.
26
26
# Can be used with `nginx_version` to fine tune control which version of NGINX is installed/used on each playbook execution.
27
27
# 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.
29
29
# Using 'uninstall' will remove NGINX from your system.
30
30
# Default is install.
31
31
nginx_setup : install
Original file line number Diff line number Diff line change 2
2
- name : Converge
3
3
hosts : all
4
4
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"
5
9
- name : Set repo if Debian
6
10
ansible.builtin.set_fact :
7
- version : " =1.22.0 -1~{{ ansible_facts['distribution_release'] }}"
11
+ version : " =1.21.6 -1~{{ ansible_facts['distribution_release'] }}"
8
12
when : ansible_facts['os_family'] == "Debian"
9
13
- name : Set repo if Red Hat
10
14
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"
12
16
when : ansible_facts['os_family'] == "RedHat"
13
17
tasks :
14
18
- name : Install NGINX
15
19
ansible.builtin.include_role :
16
20
name : ansible-role-nginx
17
21
vars :
18
22
nginx_version : " {{ version }}"
19
- nginx_branch : stable
Original file line number Diff line number Diff line change 6
6
yamllint .
7
7
ansible-lint --force-color
8
8
platforms :
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"
9
37
- name : amazonlinux-2
10
38
image : amazonlinux:2
11
39
dockerfile : ../common/Dockerfile.j2
Original file line number Diff line number Diff line change 2
2
- name : Prepare
3
3
hosts : all
4
4
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"
5
9
- name : Set repo if Debian
6
10
ansible.builtin.set_fact :
7
11
version : " =1.23.0-1~{{ ansible_facts['distribution_release'] }}"
Original file line number Diff line number Diff line change 24
24
url : http://localhost
25
25
status_code : 200
26
26
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
-
38
27
- name : Verify NGINX has been downgraded
39
28
ansible.builtin.command : nginx -v
40
29
args :
41
30
chdir : " {{ ((ansible_facts['system'] | lower is not search('bsd')) | ternary('/etc/nginx', '/usr/local/sbin')) }}"
42
31
changed_when : false
43
32
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 6
6
yamllint .
7
7
ansible-lint --force-color
8
8
platforms :
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"
9
37
- name : amazonlinux-2
10
38
image : amazonlinux:2
11
39
dockerfile : ../common/Dockerfile.j2
Original file line number Diff line number Diff line change 2
2
- name : Prepare
3
3
hosts : all
4
4
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"
5
9
- name : Set repo if Debian
6
10
ansible.builtin.set_fact :
7
11
version : " =1.21.6-1~{{ ansible_facts['distribution_release'] }}"
Original file line number Diff line number Diff line change 13
13
state : " {{ nginx_state }}"
14
14
update_cache : true
15
15
ignore_errors : " {{ ansible_check_mode }}"
16
+ when : not (nginx_setup == 'upgrade' and nginx_version is not defined)
16
17
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