Merge pull request #34 from nginxinc/(feature)/select-repositories
Implement support to select NGINX repository
This commit is contained in:
commit
ba092d09ef
36
.travis.yml
36
.travis.yml
@ -5,55 +5,73 @@ services:
|
|||||||
env:
|
env:
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 6
|
version: 6
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: centos
|
|
||||||
version: 6
|
|
||||||
playbook: template
|
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 6
|
version: 6
|
||||||
playbook: push
|
playbook: push
|
||||||
|
- distribution: centos
|
||||||
|
version: 6
|
||||||
|
playbook: stable
|
||||||
|
- distribution: centos
|
||||||
|
version: 6
|
||||||
|
playbook: template
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 7
|
version: 7
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 7
|
version: 7
|
||||||
playbook: template
|
playbook: template
|
||||||
|
- distribution: centos
|
||||||
|
version: 7
|
||||||
|
playbook: stable
|
||||||
- distribution: centos
|
- distribution: centos
|
||||||
version: 7
|
version: 7
|
||||||
playbook: push
|
playbook: push
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: jessie
|
version: jessie
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: jessie
|
version: jessie
|
||||||
playbook: template
|
playbook: template
|
||||||
|
- distribution: debian
|
||||||
|
version: jessie
|
||||||
|
playbook: stable
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: jessie
|
version: jessie
|
||||||
playbook: push
|
playbook: push
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: stretch
|
version: stretch
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: stretch
|
version: stretch
|
||||||
playbook: template
|
playbook: template
|
||||||
|
- distribution: debian
|
||||||
|
version: stretch
|
||||||
|
playbook: stable
|
||||||
- distribution: debian
|
- distribution: debian
|
||||||
version: stretch
|
version: stretch
|
||||||
playbook: push
|
playbook: push
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: trusty
|
version: trusty
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: trusty
|
version: trusty
|
||||||
playbook: template
|
playbook: template
|
||||||
|
- distribution: ubuntu
|
||||||
|
version: trusty
|
||||||
|
playbook: stable
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: trusty
|
version: trusty
|
||||||
playbook: push
|
playbook: push
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: xenial
|
version: xenial
|
||||||
playbook: opensource
|
playbook: basic
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: xenial
|
version: xenial
|
||||||
playbook: template
|
playbook: template
|
||||||
|
- distribution: ubuntu
|
||||||
|
version: xenial
|
||||||
|
playbook: stable
|
||||||
- distribution: ubuntu
|
- distribution: ubuntu
|
||||||
version: xenial
|
version: xenial
|
||||||
playbook: push
|
playbook: push
|
||||||
|
21
README.md
21
README.md
@ -84,12 +84,31 @@ 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 repository origin for NGINX Open Source.
|
||||||
|
# Options are 'nginx_repository' or 'os_repository'.
|
||||||
|
# Only works if 'type' is set to 'opensource'.
|
||||||
|
# Default is nginx_repository.
|
||||||
|
install_from: nginx_repository
|
||||||
|
|
||||||
|
# Specify source repository for NGINX Open Source.
|
||||||
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
|
# Defaults are the official NGINX repositories.
|
||||||
|
nginx_repository:
|
||||||
|
debian:
|
||||||
|
- 'deb https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx'
|
||||||
|
- 'deb-src https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx'
|
||||||
|
redhat:
|
||||||
|
- https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
|
||||||
|
suse:
|
||||||
|
- https://nginx.org/packages/{{ "mainline/" if branch == "mainline" }}sles/12
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -4,8 +4,27 @@
|
|||||||
# Default is 'opensource'.
|
# Default is 'opensource'.
|
||||||
type: opensource
|
type: opensource
|
||||||
|
|
||||||
|
# Specify repository origin for NGINX Open Source.
|
||||||
|
# Options are 'nginx_repository' or 'os_repository'.
|
||||||
|
# Only works if 'type' is set to 'opensource'.
|
||||||
|
# Default is nginx_repository.
|
||||||
|
install_from: nginx_repository
|
||||||
|
|
||||||
|
# Specify source repository for NGINX Open Source.
|
||||||
|
# Only works if 'install_from' is set to 'nginx_repository'.
|
||||||
|
# Defaults are the official NGINX repositories.
|
||||||
|
nginx_repository:
|
||||||
|
debian:
|
||||||
|
- deb https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
||||||
|
- deb-src https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
||||||
|
redhat:
|
||||||
|
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}{{ (ansible_distribution == "RedHat") | ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
|
||||||
|
suse:
|
||||||
|
- https://nginx.org/packages/{{ (branch == 'mainline') | ternary('mainline/','') }}sles/12
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
- name: ""
|
||||||
|
block:
|
||||||
|
|
||||||
- import_tasks: setup-debian.yml
|
- import_tasks: setup-debian.yml
|
||||||
when: ansible_os_family == "Debian"
|
when: ansible_os_family == "Debian"
|
||||||
|
|
||||||
@ -24,3 +27,12 @@
|
|||||||
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"
|
||||||
|
@ -1,16 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: "(Install: Debian/Ubuntu) Add Mainline NGINX Repository"
|
- name: "(Install: Debian/Ubuntu) Add NGINX Repository"
|
||||||
apt_repository:
|
apt_repository:
|
||||||
repo: "{{ item }}"
|
repo: "{{ item }}"
|
||||||
with_items:
|
with_items:
|
||||||
- deb https://nginx.org/packages/mainline/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
- "{{ nginx_repository.debian }}"
|
||||||
- deb-src https://nginx.org/packages/mainline/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
|
||||||
when: branch == "mainline"
|
|
||||||
|
|
||||||
- name: "(Install: Debian/Ubuntu) Add Stable NGINX Repository"
|
|
||||||
apt_repository:
|
|
||||||
repo: "{{ item }}"
|
|
||||||
with_items:
|
|
||||||
- deb https://nginx.org/packages/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
|
||||||
- deb-src https://nginx.org/packages/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
|
|
||||||
when: branch == "stable"
|
|
||||||
|
@ -1,36 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: "(Install: RedHat) Add Mainline NGINX Repository"
|
- name: "(Install: CentOS/RedHat) Add NGINX Repository"
|
||||||
yum_repository:
|
yum_repository:
|
||||||
name: nginx
|
name: nginx
|
||||||
baseurl: https://nginx.org/packages/mainline/rhel/{{ ansible_distribution_major_version|int }}/$basearch/
|
baseurl: "{{ nginx_repository.redhat }}"
|
||||||
description: NGINX Repository
|
description: NGINX Repository
|
||||||
enabled: yes
|
enabled: yes
|
||||||
gpgcheck: yes
|
gpgcheck: yes
|
||||||
when: branch == "mainline" and ansible_distribution == "RedHat"
|
|
||||||
|
|
||||||
- name: "(Install: CentOS) Add Mainline NGINX Repository"
|
|
||||||
yum_repository:
|
|
||||||
name: nginx
|
|
||||||
baseurl: https://nginx.org/packages/mainline/centos/{{ ansible_distribution_major_version|int }}/$basearch/
|
|
||||||
description: NGINX Repository
|
|
||||||
enabled: yes
|
|
||||||
gpgcheck: yes
|
|
||||||
when: branch == "mainline" and ansible_distribution == "CentOS"
|
|
||||||
|
|
||||||
- name: "(Install: RedHat) Add Stable NGINX Repository"
|
|
||||||
yum_repository:
|
|
||||||
name: nginx
|
|
||||||
baseurl: https://nginx.org/packages/rhel/{{ ansible_distribution_major_version|int }}/$basearch/
|
|
||||||
description: NGINX Repository
|
|
||||||
enabled: yes
|
|
||||||
gpgcheck: yes
|
|
||||||
when: branch == "stable" and ansible_distribution == "RedHat"
|
|
||||||
|
|
||||||
- name: "(Install: CentOS) Add Stable NGINX Repository"
|
|
||||||
yum_repository:
|
|
||||||
name: nginx
|
|
||||||
baseurl: https://nginx.org/packages/centos/{{ ansible_distribution_major_version|int }}/$basearch/
|
|
||||||
description: NGINX Repository
|
|
||||||
enabled: yes
|
|
||||||
gpgcheck: yes
|
|
||||||
when: branch == "stable" and ansible_distribution == "CentOS"
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: "(Install: SUSE) Add Mainline NGINX Repository"
|
- name: "(Install: SUSE) Add NGINX Repository"
|
||||||
zypper_repository:
|
zypper_repository:
|
||||||
name: nginx
|
name: nginx
|
||||||
repo: https://nginx.org/packages/mainline/sles/12
|
repo: "{{ nginx_repository.suse }}"
|
||||||
when: branch == "mainline"
|
|
||||||
|
|
||||||
- name: "(Install: SUSE) Add Stable NGINX Repository"
|
|
||||||
zypper_repository:
|
|
||||||
name: nginx
|
|
||||||
repo: https://nginx.org/packages/sles/12
|
|
||||||
when: branch == "stable"
|
|
||||||
|
8
tests/playbooks/nginx-stable.yml
Normal file
8
tests/playbooks/nginx-stable.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
become: true
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- ansible-role-nginx
|
||||||
|
vars:
|
||||||
|
branch: stable
|
Loading…
Reference in New Issue
Block a user