Skip to content

Commit 8baa94e

Browse files
authored
Add option to use/update to the latest version of NGINX (#202)
Resolves #132
1 parent c2c0bb9 commit 8baa94e

File tree

9 files changed

+18
-7
lines changed

9 files changed

+18
-7
lines changed

defaults/main/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ nginx_type: opensource
1919
# Default is empty.
2020
# nginx_version: =19-1~bionic
2121

22+
# Specify whether you want to maintain your version of NGINX or upgrade to the latest version.
23+
# Can be used with `nginx_version` to achieve fine tune control on which version of NGINX is installed/used on each playbook execution.
24+
# Using 'present' will install the latest version (or 'nginx_version') of NGINX on a fresh install.
25+
# Using 'latest' will upgrade NGINX to the latest version (that matches your 'nginx_version') of NGINX on every playbook execution.
26+
# Default is present.
27+
nginx_state: present
28+
2229
# Specify repository origin for NGINX Open Source.
2330
# Options are 'nginx_repository' or 'os_repository'.
2431
# Only works if 'nginx_type' is set to 'opensource'.

tasks/opensource/install-oss-bsd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
- name: "(Install: FreeBSD) Install NGINX package"
2323
pkgng:
2424
name: "www/nginx{{ nginx_version | default('') }}"
25-
state: present
25+
state: "{{ nginx_state }}"
2626
when: nginx_bsd_install_packages
2727
notify: "(Handler: All OSs) Start NGINX"
2828

2929
- name: "(Install: FreeBSD) Install NGINX port"
3030
portinstall:
3131
name: "www/nginx{{ nginx_version | default('') }}"
3232
use_packages: "{{ nginx_bsd_portinstall_use_packages | default(omit) }}"
33-
state: present
33+
state: "{{ nginx_state }}"
3434
when: not nginx_bsd_install_packages
3535
notify: "(Handler: All OSs) Start NGINX"
3636

@@ -43,15 +43,15 @@
4343
openbsd_pkg:
4444
name: "nginx{{ nginx_version | default('') }}"
4545
build: false
46-
state: present
46+
state: "{{ nginx_state }}"
4747
when: nginx_bsd_install_packages
4848
notify: "(Handler: All OSs) Start NGINX"
4949

5050
- name: "(Install: OpenBSD) Install NGINX port"
5151
openbsd_pkg:
5252
name: "nginx{{ nginx_version | default('') }}"
5353
build: true
54-
state: present
54+
state: "{{ nginx_state }}"
5555
when: not nginx_bsd_install_packages
5656
notify: "(Handler: All OSs) Start NGINX"
5757

tasks/opensource/install-oss-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
- name: "(Install: Linux) Install NGINX package"
2020
package:
2121
name: "nginx{{ nginx_version | default('') }}"
22-
state: present
22+
state: "{{ nginx_state }}"
2323
when: nginx_install_from == "os_repository"
2424
notify: "(Handler: All OSs) Start NGINX"

tasks/opensource/setup-alpine.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
apk:
2626
name: "nginx{{ nginx_version | default('') }}"
2727
repository: "{{ repository }}"
28+
state: "{{ nginx_state }}"
2829
notify: "(Handler: All OSs) Start NGINX"

tasks/opensource/setup-debian.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
- name: "(Install: Debian/Ubuntu) Install NGINX"
2323
apt:
2424
name: "nginx{{ nginx_version | default('') }}"
25+
state: "{{ nginx_state }}"
2526
notify: "(Handler: All OSs) Start NGINX"

tasks/opensource/setup-redhat.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
- name: "(Install: CentOS/RedHat) Install NGINX"
2626
yum:
2727
name: "nginx{{ nginx_version | default('') }}"
28+
state: "{{ nginx_state }}"
2829
disablerepo: "*"
2930
enablerepo: "nginx"
3031
notify: "(Handler: All OSs) Start NGINX"

tasks/opensource/setup-suse.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@
1717
- name: "(Install: SUSE) Install NGINX"
1818
zypper:
1919
name: "nginx{{ nginx_version | default('') }}"
20+
state: "{{ nginx_state }}"
2021
notify: "(Handler: All OSs) Start NGINX"

tasks/plus/install-plus-bsd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
- name: "(Install: FreeBSD) Install nginx-plus{{ nginx_version | default('') }}"
2525
pkgng:
2626
name: "nginx-plus{{ nginx_version | default('') }}"
27-
state: present
27+
state: "{{ nginx_state }}"
2828
notify: "(Handler: All OSs) Start NGINX"
2929

3030
when: ansible_system == "FreeBSD"

tasks/plus/install-plus-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
- name: "(Install: Linux) Install NGINX Plus"
1515
package:
1616
name: "nginx-plus{{ nginx_version | default('') }}"
17-
state: present
17+
state: "{{ nginx_state }}"
1818
notify: "(Handler: All OSs) Start NGINX"

0 commit comments

Comments
 (0)