Skip to content

Commit

Permalink
Add 'nginx_manage_repo' feature flag and defaults (#420)
Browse files Browse the repository at this point in the history
Co-authored-by: Jurgen Verhasselt <[email protected]>
Co-authored-by: Jurgen Verhasselt <[email protected]>
  • Loading branch information
3 people authored Jun 14, 2021
1 parent f1272ef commit 3a63b9a
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

FEATURES:

* Add a `nginx_manage_repo` feature flag which allows disabling NGINX repo management by this role.
* Add a `nginx_install_epel_release` feature flag which allows epel-release to not be installed by this role if so desired.

## 0.20.0 (June 9, 2021)
Expand Down
6 changes: 6 additions & 0 deletions defaults/main/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ nginx_type: opensource
# Default is present.
nginx_state: present

# Specify whether or not you want to manage the NGINX repositories.
# Using 'true' will manage NGINX repositories.
# Using 'false' will not manage the NGINX repositories, allowing them to be managed through other means.
# Default is true
nginx_manage_repo: true

# Specify repository origin for NGINX Open Source.
# Options are 'nginx_repository', 'source' or 'os_repository'.
# Only works if 'nginx_type' is set to 'opensource'.
Expand Down
1 change: 1 addition & 0 deletions tasks/opensource/install-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
path: /etc/apk/repositories
insertafter: EOF
line: "{{ nginx_repository | default(nginx_default_repository_alpine) }}"
when: nginx_manage_repo | bool

- name: (Alpine Linux) Install NGINX
apk:
Expand Down
1 change: 1 addition & 0 deletions tasks/opensource/install-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
update_cache: true
mode: 0644
loop: "{{ nginx_repository | default(nginx_default_repository_debian) }}"
when: nginx_manage_repo | bool

- name: (Debian/Ubuntu) Install NGINX
apt:
Expand Down
8 changes: 6 additions & 2 deletions tasks/opensource/install-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
enabled: true
gpgcheck: true
mode: 0644
when: ansible_facts['distribution_major_version'] is version('8', '<')
when:
- ansible_facts['distribution_major_version'] is version('8', '<')
- nginx_manage_repo | bool

- name: (CentOS/RHEL 8) Configure NGINX repository
blockinfile:
Expand All @@ -21,7 +23,9 @@
name = NGINX Repository
module_hotfixes = true
mode: 0644
when: ansible_facts['distribution_major_version'] is version('8', '==')
when:
- ansible_facts['distribution_major_version'] is version('8', '==')
- nginx_manage_repo | bool

- name: (CentOS/RHEL) Install NGINX
yum:
Expand Down
1 change: 1 addition & 0 deletions tasks/opensource/install-suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
zypper_repository:
name: "nginx-{{ nginx_branch }}"
repo: "{{ nginx_repository | default(nginx_default_repository_suse) }}"
when: nginx_manage_repo | bool

- name: (SLES) Install NGINX
zypper:
Expand Down
1 change: 1 addition & 0 deletions tasks/plus/install-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
insertafter: EOF
line: "{{ nginx_repository | default(nginx_plus_default_repository_alpine) }}"
state: "{{ nginx_license_status | default ('present') }}"
when: nginx_manage_repo | bool

- name: (Alpine Linux) Install NGINX Plus
apk:
Expand Down
1 change: 1 addition & 0 deletions tasks/plus/install-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
update_cache: false
state: "{{ nginx_license_status | default ('present') }}"
mode: 0644
when: nginx_manage_repo | bool

- name: (Debian/Ubuntu) Install NGINX Plus
apt:
Expand Down
1 change: 1 addition & 0 deletions tasks/plus/install-freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
}
state: "{{ nginx_license_status | default ('present') }}"
mode: 0644
when: nginx_manage_repo | bool

- name: (FreeBSD) Install NGINX Plus
pkgng:
Expand Down
1 change: 1 addition & 0 deletions tasks/plus/install-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
gpgcheck: true
state: "{{ nginx_license_status | default ('present') }}"
mode: 0644
when: nginx_manage_repo | bool

- name: (Amazon Linux/CentOS/Oracle Linux/RHEL) Install NGINX Plus
yum:
Expand Down
1 change: 1 addition & 0 deletions tasks/plus/install-suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
name: nginx-plus
repo: "{{ nginx_repository | default(nginx_plus_default_repository_suse) }}"
state: "{{ nginx_license_status | default ('present') }}"
when: nginx_manage_repo | bool

- name: (SLES) Install NGINX Plus
zypper:
Expand Down

0 comments on commit 3a63b9a

Please sign in to comment.