Implement support to select NGINX repository

Resolve #32 - Initial options include using the default NGINX packages included in the host system or using the NGINX packages included in the NGINX repository
This commit is contained in:
Alessandro Fael Garcia 2018-05-11 13:31:31 -07:00
parent aef307f5a2
commit 98974fbf1a
3 changed files with 42 additions and 18 deletions

View File

@ -84,12 +84,18 @@ This role has multiple variables. The defaults for all these variables are the f
# Default is 'opensource'. # Default is 'opensource'.
type: opensource type: opensource
# Specify source respository for NGINX Open Source.
# Options are 'nginx_repository' or 'os_repository'.
# Default is nginx_repository.
install_from: nginx_repository
# Specify which branch of NGINX Open Source you want to install. # Specify which branch of NGINX Open Source you want to install.
# Options are 'mainline' or 'stable'. # Options are 'mainline' or 'stable'.
# Only works if 'install_from' is set to 'nginx_repository'.
# Default is mainline. # Default is mainline.
branch: mainline branch: mainline
# Install nginscript, perl, waf (NGINX Plus only), geoip, image-filter, rtmp and/or xslt modules. # Install NGINX JavaScript, Perl, ModSecurity WAF (NGINX Plus only), GeoIP, Image-Filter, RTMP Media Streaming, and/or XSLT modules.
# Default is false. # Default is false.
modules: modules:
njs: false njs: false

View File

@ -4,8 +4,14 @@
# Default is 'opensource'. # Default is 'opensource'.
type: opensource type: opensource
# Specify source respository for NGINX Open Source.
# Options are 'nginx_repository' or 'os_repository'.
# Default is nginx_repository.
install_from: nginx_repository
# Specify which branch of NGINX Open Source you want to install. # Specify which branch of NGINX Open Source you want to install.
# Options are 'mainline' or 'stable'. # Options are 'mainline' or 'stable'.
# Only works if 'install_from' is set to 'nginx_repository'.
# Default is mainline. # Default is mainline.
branch: mainline branch: mainline

View File

@ -1,26 +1,38 @@
--- ---
- import_tasks: setup-debian.yml - name: ""
block:
- import_tasks: setup-debian.yml
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- import_tasks: setup-redhat.yml - import_tasks: setup-redhat.yml
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- import_tasks: setup-suse.yml - import_tasks: setup-suse.yml
when: ansible_os_family == "Suse" when: ansible_os_family == "Suse"
- import_tasks: setup-freebsd.yml - import_tasks: setup-freebsd.yml
when: ansible_os_family == "FreeBSD" when: ansible_os_family == "FreeBSD"
- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX" - name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX"
package: package:
name: nginx name: nginx
state: present state: present
when: ansible_os_family != "FreeBSD" when: ansible_os_family != "FreeBSD"
notify: "(Handler: All OSs) Start NGINX" notify: "(Handler: All OSs) Start NGINX"
- name: "(Install: FreeBSD) Install NGINX" - name: "(Install: FreeBSD) Install NGINX"
portinstall: portinstall:
name: nginx name: nginx
state: present state: present
when: ansible_os_family == "FreeBSD" when: ansible_os_family == "FreeBSD"
notify: "(Handler: All OSs) Start NGINX" notify: "(Handler: All OSs) Start NGINX"
when: install_from == "nginx_repository"
- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
package:
name: nginx
state: present
when: install_from == "os_repository"
notify: "(Handler: All OSs) Start NGINX"