diff --git a/README.md b/README.md index 6ad524e..7596411 100644 --- a/README.md +++ b/README.md @@ -84,12 +84,18 @@ This role has multiple variables. The defaults for all these variables are the f # Default is '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. # Options are 'mainline' or 'stable'. + # Only works if 'install_from' is set to 'nginx_repository'. # Default is 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. modules: njs: false diff --git a/defaults/main.yml b/defaults/main.yml index 10fb067..020fc8c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,8 +4,14 @@ # Default is '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. # Options are 'mainline' or 'stable'. +# Only works if 'install_from' is set to 'nginx_repository'. # Default is mainline. branch: mainline diff --git a/tasks/opensource/install-oss.yml b/tasks/opensource/install-oss.yml index 1ae3fd6..d19e5a5 100644 --- a/tasks/opensource/install-oss.yml +++ b/tasks/opensource/install-oss.yml @@ -1,26 +1,38 @@ --- -- import_tasks: setup-debian.yml - when: ansible_os_family == "Debian" +- name: "" + block: -- import_tasks: setup-redhat.yml - when: ansible_os_family == "RedHat" + - import_tasks: setup-debian.yml + when: ansible_os_family == "Debian" -- import_tasks: setup-suse.yml - when: ansible_os_family == "Suse" + - import_tasks: setup-redhat.yml + when: ansible_os_family == "RedHat" -- import_tasks: setup-freebsd.yml - when: ansible_os_family == "FreeBSD" + - import_tasks: setup-suse.yml + when: ansible_os_family == "Suse" -- name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX" + - import_tasks: setup-freebsd.yml + when: ansible_os_family == "FreeBSD" + + - name: "(Install: Debian/Ubuntu/CentOS/RedHat) Install NGINX" + package: + name: nginx + state: present + when: ansible_os_family != "FreeBSD" + notify: "(Handler: All OSs) Start NGINX" + + - name: "(Install: FreeBSD) Install NGINX" + portinstall: + name: nginx + state: present + when: ansible_os_family == "FreeBSD" + 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: ansible_os_family != "FreeBSD" - notify: "(Handler: All OSs) Start NGINX" - -- name: "(Install: FreeBSD) Install NGINX" - portinstall: - name: nginx - state: present - when: ansible_os_family == "FreeBSD" + when: install_from == "os_repository" notify: "(Handler: All OSs) Start NGINX"