This commit is contained in:
2023-03-09 18:02:25 +03:00
commit a81f423baa
93 changed files with 2357 additions and 0 deletions

View File

@ -0,0 +1,16 @@
---
- name: (Amazon Linux/CentOS/Debian/RedHat/Ubuntu) Install NGINX Unit modules
package:
name: "{{ item }}"
state: present
loop: "{{ nginx_unit_modules }}"
when: ansible_facts['os_family'] != "FreeBSD"
notify: (Handler - Amazon Linux/CentOS/Debian/RedHat/Ubuntu) Start NGINX Unit
- name: (FreeBSD) Install NGINX Unit modules
portinstall:
name: "{{ item }}"
state: present
loop: "{{ nginx_unit_modules }}"
when: ansible_facts['os_family'] == "FreeBSD"
notify: (Handler - FreeBSD) Start NGINX Unit

View File

@ -0,0 +1,22 @@
---
- name: Configure NGINX Unit repository
include_tasks: "{{ role_path }}/tasks/unit/setup-{{ ansible_facts['os_family'] | lower }}.yml"
when: ansible_facts['os_family'] in ['Debian', 'FreeBSD', 'RedHat']
- name: (Amazon Linux/CentOS/Debian/RedHat/Ubuntu) Install NGINX Unit
package:
name: unit
state: present
when: ansible_facts['os_family'] != "FreeBSD"
notify: (Handler - Amazon Linux/CentOS/Debian/RedHat/Ubuntu) Start NGINX Unit
- name: (FreeBSD) Install NGINX Unit
portinstall:
name: unit
state: present
when: ansible_facts['os_family'] == "FreeBSD"
notify: (Handler - FreeBSD) Start NGINX Unit
- name: Install NGINX Unit modules
include_tasks: "{{ role_path }}/tasks/unit/install-modules.yml"
when: nginx_unit_modules is defined

View File

@ -0,0 +1,10 @@
---
- name: "(Debian/Ubuntu) Add NGINX Unit repository"
apt_repository:
filename: nginx-unit
repo: "{{ item }}"
update_cache: yes
mode: 0644
loop:
- deb [arch=amd64] https://packages.nginx.org/unit/{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} unit
- deb-src https://packages.nginx.org/unit/{{ ansible_facts['distribution'] | lower }}/ {{ ansible_facts['distribution_release'] }} unit

View File

@ -0,0 +1,10 @@
---
- name: (FreeBSD) fetch ports
command: portsnap fetch --interactive
args:
creates: /var/db/portsnap/INDEX
- name: (FreeBSD) Extract ports
command: portsnap extract
args:
creates: /usr/ports

View File

@ -0,0 +1,21 @@
---
- name: (CentOS/RHEL) Add NGINX Unit repository
yum_repository:
name: nginx-unit
baseurl: "https://packages.nginx.org/unit/{{ (ansible_facts['distribution'] == 'RedHat') | ternary('rhel/', 'centos/') }}$releasever/$basearch/"
description: NGINX Unit Repository
enabled: yes
gpgcheck: yes
mode: 0644
when: ansible_facts['distribution'] != "Amazon"
- name: (Amazon Linux) Add NGINX Unit repository
yum_repository:
name: nginx-unit
baseurl: "https://packages.nginx.org/unit/amzn\
{{ (ansible_facts['distribution_major_version'] is version('2', '==')) | ternary('2', '') }}/$releasever/$basearch/"
description: NGINX Unit Repository
enabled: yes
gpgcheck: yes
mode: 0644
when: ansible_facts['distribution'] == "Amazon"