Skip to content

Add support to the role for RHEL 8 and Alpine Linux #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 60 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ It supports all platforms supported by [NGINX Open Source](https://nginx.org/en/
**NGINX Open Source**

```yaml
Alpine:
versions:
- 3.8
- 3.9
CentOS:
versions:
- 6
- 7
- 7.4+
RedHat:
versions:
- 6
- 7
- 7.4+
- 8
Debian:
versions:
- jessie
Expand All @@ -36,62 +41,69 @@ Ubuntu:
versions:
- trusty
- xenial
- artful
- bionic
SUSE/SLES:
versions:
- 12
- 15
FreeBSD:
versions:
- 10
- 11
- 11.2+
- 12
```

**NGINX Plus**

```yaml
CentOS:
Alpine:
versions:
- 6
- 7
RedHat:
- 3.8
- 3.9
Amazon Linux:
versions:
- 6
- 7
- 2018.03
Amazon Linux 2:
versions:
- LTS
CentOS:
versions:
- 6.5+
- 7.4+
Debian:
versions:
- jessie
- stretch
Ubuntu:
FreeBSD:
versions:
- trusty
- xenial
- artful
- bionic
- 11.2+
- 12
Oracle Linux:
versions:
- 6.5
- 7
Amazon Linux:
versions:
- 2018.03
SUSE/SLES:
- 6.5+
- 7.4+
RedHat:
versions:
- 12
FreeBSD:
- 6.5+
- 7.4+
- 8
SUSE/SLES:
versions:
- 12
- 15
Ubuntu:
versions:
- 10
- 11
- trusty
- xenial
- bionic
```

**NGINX Amplify**

```yaml
CentOS:
Amazon Linux:
versions:
- 6
- 7
RedHat:
- 2017.09
CentOS:
versions:
- 6
- 7
Expand All @@ -103,21 +115,25 @@ Ubuntu:
versions:
- trusty
- xenial
- artful
- bionic
Amazon Linux:
- bionic
RedHat:
versions:
- 2017.09
- 6
- 7
```

**NGINX Controller**

```yaml
CentOS:
Amazon Linux:
versions:
- 7
RedHat:
- 2017.09
Amazon Linux 2:
versions:
- LTS
CentOS:
versions:
- 6
- 7
Debian:
versions:
Expand All @@ -126,7 +142,11 @@ Debian:
Ubuntu:
versions:
- xenial
- artful
- bionic
RedHat:
versions:
- 6
- 7
```

**NGINX Unit**
Expand All @@ -147,11 +167,12 @@ Debian:
Ubuntu:
versions:
- xenial
- artful
- bionic
Amazon Linux:
versions:
- 2018.03
Amazon Linux 2:
versions:
- 2
FreeBSD:
versions:
Expand Down
17 changes: 9 additions & 8 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,23 @@ nginx_install_from: nginx_repository
# Only works if 'install_from' is set to 'nginx_repository'.
# Defaults are the official NGINX repositories.
nginx_repository:
alpine: >-
https://nginx.org/packages/{{ (nginx_branch == 'mainline')
| ternary('mainline/', '') }}alpine/v{{ ansible_distribution_version | regex_search('^[0-9]+\\.[0-9]+') }}/main
debian:
- >-
deb https://nginx.org/packages/{{ (nginx_branch == 'mainline')
| ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
| ternary('mainline/', '') }}{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} nginx
- >-
deb-src https://nginx.org/packages/{{ (nginx_branch == 'mainline')
| ternary('mainline/', '') }}{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} nginx
redhat:
- >-
| ternary('mainline/', '') }}{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} nginx
redhat: >-
https://nginx.org/packages/{{ (nginx_branch == 'mainline')
| ternary('mainline/', '') }}{{ (ansible_distribution == "RedHat")
| ternary('rhel/', 'centos/') }}{{ ansible_distribution_major_version|int }}/$basearch/
suse:
- >-
| ternary('rhel', 'centos') }}/{{ ansible_distribution_major_version }}/$basearch/
suse: >-
https://nginx.org/packages/{{ (nginx_branch == 'mainline')
| ternary('mainline/', '') }}sles/12
| ternary('mainline/', '') }}sles/{{ ansible_distribution_major_version }}

# Specify which branch of NGINX Open Source you want to install.
# Options are 'mainline' or 'stable'.
Expand Down
65 changes: 32 additions & 33 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
---
- name: "(Handler: All OSs) Start NGINX"
service:
name: nginx
state: started
enabled: yes
when: nginx_start
- name: "(Handler: All OSs) Run NGINX"
block:

- name: "(Handler: All OSs) Reload NGINX"
service:
name: nginx
state: reloaded
when: nginx_start
- name: "(Handler: All OSs) Start NGINX"
service:
name: nginx
state: started
enabled: yes

- name: "(Handler: All OSs) Start NGINX Amplify Agent"
service:
name: amplify-agent
state: started
when: nginx_start
- name: "(Handler: All OSs) Reload NGINX"
service:
name: nginx
state: reloaded

- name: "(Handler: All OSs) Start NGINX Controller Agent"
service:
name: controller-agent
state: started
when: nginx_start
- name: "(Handler: All OSs) Start NGINX Amplify Agent"
service:
name: amplify-agent
state: started

- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
service:
name: unit
state: started
enabled: yes
when: nginx_start
- name: "(Handler: All OSs) Start NGINX Controller Agent"
service:
name: controller-agent
state: started

- name: "(Handler: FreeBSD) Start NGINX Unit"
service:
name: unitd
state: started
enabled: yes
when: nginx_start
- name: "(Handler: Debian/Ubuntu/CentOS/RedHat) Start NGINX Unit"
service:
name: unit
state: started
enabled: yes

- name: "(Handler: FreeBSD) Start NGINX Unit"
service:
name: unitd
state: started
enabled: yes

when: nginx_start | bool
47 changes: 26 additions & 21 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,32 @@ galaxy_info:
min_ansible_version: 2.4.0.0

platforms:
- name: Debian
versions:
- jessie
- stretch
- name: Ubuntu
versions:
- trusty
- xenial
- artful
- bionic
- name: EL
versions:
- 6
- 7
- name: SLES
versions:
- 12
- name: FreeBSD
versions:
- 10.4
- 11.2
- name: Alpine
versions:
- all
- name: Amazon Linux
- candidate
- name: Debian
versions:
- jessie
- stretch
- name: EL
versions:
- 6
- 7
- name: FreeBSD
versions:
- 11.2
- 12.0
- name: Ubuntu
versions:
- trusty
- xenial
- bionic
- name: SLES
versions:
- 12
- 15

galaxy_tags:
- nginx
Expand Down
5 changes: 5 additions & 0 deletions tasks/keys/apk-key.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: "(Install: APK OSs) Download NGINX Signing Key"
get_url:
url: https://nginx.org/keys/nginx_signing.rsa.pub
dest: /etc/apk/keys/nginx_signing.rsa.pub
21 changes: 12 additions & 9 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
or nginx_controller_enable
or nginx_unit_enable

- import_tasks: keys/apk-key.yml
when: ansible_os_family == "Alpine"

- name: "(Install: Debian/Ubuntu/CentOS/RedHat/FreeBSD) Install NGINX"
block:

Expand All @@ -28,7 +31,7 @@
when: nginx_type == "plus"

- import_tasks: conf/cleanup-config.yml
when: nginx_cleanup_config
when: nginx_cleanup_config | bool

- import_tasks: modules/install-modules.yml
when: true in nginx_modules.values()
Expand All @@ -47,26 +50,26 @@
or nginx_rest_api_enable

- import_tasks: conf/setup-status.yml
when: nginx_status_enable
when: nginx_status_enable | bool

- import_tasks: conf/debug-output.yml
when: nginx_debug_output
when: nginx_debug_output | bool

when: nginx_enable
when: nginx_enable | bool

- import_tasks: amplify/install-amplify.yml
when:
- nginx_amplify_enable
- nginx_amplify_enable | bool
- nginx_amplify_api_key is defined
- nginx_amplify_api_key | length > 0

- import_tasks: controller/install-controller.yml
when:
- nginx_controller_enable
- nginx_controller_enable | bool
- nginx_controller_api_key is defined
- nginx_controller_api_key
- nginx_controller_api_key | length > 0
- nginx_controller_api_endpoint is defined
- nginx_controller_api_endpoint
- nginx_controller_api_endpoint | length > 0

- import_tasks: unit/install-unit.yml
when: nginx_unit_enable
when: nginx_unit_enable | bool
Loading