Add option to use/update to the latest version of NGINX (#202)

Resolves #132
This commit is contained in:
Alessandro Fael Garcia 2019-12-06 16:48:15 -08:00 committed by GitHub
parent c2c0bb990a
commit 8baa94e736
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 18 additions and 7 deletions

View File

@ -19,6 +19,13 @@ nginx_type: opensource
# Default is empty.
# nginx_version: =19-1~bionic
# Specify whether you want to maintain your version of NGINX or upgrade to the latest version.
# Can be used with `nginx_version` to achieve fine tune control on which version of NGINX is installed/used on each playbook execution.
# Using 'present' will install the latest version (or 'nginx_version') of NGINX on a fresh install.
# Using 'latest' will upgrade NGINX to the latest version (that matches your 'nginx_version') of NGINX on every playbook execution.
# Default is present.
nginx_state: present
# Specify repository origin for NGINX Open Source.
# Options are 'nginx_repository' or 'os_repository'.
# Only works if 'nginx_type' is set to 'opensource'.

View File

@ -22,7 +22,7 @@
- name: "(Install: FreeBSD) Install NGINX package"
pkgng:
name: "www/nginx{{ nginx_version | default('') }}"
state: present
state: "{{ nginx_state }}"
when: nginx_bsd_install_packages
notify: "(Handler: All OSs) Start NGINX"
@ -30,7 +30,7 @@
portinstall:
name: "www/nginx{{ nginx_version | default('') }}"
use_packages: "{{ nginx_bsd_portinstall_use_packages | default(omit) }}"
state: present
state: "{{ nginx_state }}"
when: not nginx_bsd_install_packages
notify: "(Handler: All OSs) Start NGINX"
@ -43,7 +43,7 @@
openbsd_pkg:
name: "nginx{{ nginx_version | default('') }}"
build: false
state: present
state: "{{ nginx_state }}"
when: nginx_bsd_install_packages
notify: "(Handler: All OSs) Start NGINX"
@ -51,7 +51,7 @@
openbsd_pkg:
name: "nginx{{ nginx_version | default('') }}"
build: true
state: present
state: "{{ nginx_state }}"
when: not nginx_bsd_install_packages
notify: "(Handler: All OSs) Start NGINX"

View File

@ -19,6 +19,6 @@
- name: "(Install: Linux) Install NGINX package"
package:
name: "nginx{{ nginx_version | default('') }}"
state: present
state: "{{ nginx_state }}"
when: nginx_install_from == "os_repository"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -25,4 +25,5 @@
apk:
name: "nginx{{ nginx_version | default('') }}"
repository: "{{ repository }}"
state: "{{ nginx_state }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -22,4 +22,5 @@
- name: "(Install: Debian/Ubuntu) Install NGINX"
apt:
name: "nginx{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -25,6 +25,7 @@
- name: "(Install: CentOS/RedHat) Install NGINX"
yum:
name: "nginx{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
disablerepo: "*"
enablerepo: "nginx"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -17,4 +17,5 @@
- name: "(Install: SUSE) Install NGINX"
zypper:
name: "nginx{{ nginx_version | default('') }}"
state: "{{ nginx_state }}"
notify: "(Handler: All OSs) Start NGINX"

View File

@ -24,7 +24,7 @@
- name: "(Install: FreeBSD) Install nginx-plus{{ nginx_version | default('') }}"
pkgng:
name: "nginx-plus{{ nginx_version | default('') }}"
state: present
state: "{{ nginx_state }}"
notify: "(Handler: All OSs) Start NGINX"
when: ansible_system == "FreeBSD"

View File

@ -14,5 +14,5 @@
- name: "(Install: Linux) Install NGINX Plus"
package:
name: "nginx-plus{{ nginx_version | default('') }}"
state: present
state: "{{ nginx_state }}"
notify: "(Handler: All OSs) Start NGINX"