Initial implementation of NGINX Unit

This commit is contained in:
Alessandro Fael Garcia 2018-04-06 16:32:48 -07:00
parent 4fa9a51718
commit 548fc3f9f3
4 changed files with 144 additions and 0 deletions

View File

@ -10,3 +10,8 @@
service:
name: nginx
state: reloaded
- name: "(Handler: All OSs) Start NGINX Unit"
service:
name: unit
state: started

101
tasks/unit/install-unit.yml Normal file
View File

@ -0,0 +1,101 @@
---
- import_tasks: setup-debian.yml
when: ansible_os_family == "Debian"
- import_tasks: setup-redhat.yml
when: ansible_os_family == "RedHat"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: unit
state: present
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python
- unit-go
- unit-perl
when: ansible_distribution == "CentOS"
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python
- unit-perl
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python
- unit-go
- unit-perl
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python27
- unit-python34
- unit-python35
- unit-python36
- unit-go
- unit-perl
when: ansible_distribution == "Amazon"
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python2.7
- unit-python3.5
- unit-go
- unit-perl
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int == 16
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python2.7
- unit-python3.4
- unit-perl
when: ansible_distribution == "Debian" and ansible_distribution_major_version|int == 8
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: All OSs) Install NGINX Unit"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python2.7
- unit-python3.5
- unit-go1.7
- unit-go1.8
- unit-perl
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 9
notify: "(Handler: All OSs) Start NGINX Unit"

View File

@ -0,0 +1,11 @@
---
- name: "(Install: Debian/Ubuntu) Add NGINX Unit Repository"
apt_repository:
repo: "{{ item }}"
with_items:
- deb https://packages.nginx.org/unit/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} unit
- deb-src https://packages.nginx.org/unit/{{ ansible_distribution|lower }}/ {{ ansible_distribution_release }} unit
- name: "(Install: Debian/Ubuntu) Update APT Cache"
apt:
update_cache: yes

View File

@ -0,0 +1,27 @@
---
- name: "(Install: RedHat) Add NGINX Unit Repository"
yum_repository:
name: nginx
baseurl: https://packages.nginx.org/unit/rhel/$releasever/$basearch/
description: NGINX Repository
enabled: yes
gpgcheck: yes
when: ansible_distribution == "RedHat"
- name: "(Install: CentOS) Add NGINX Unit Repository"
yum_repository:
name: nginx
baseurl: https://packages.nginx.org/unit/centos/$releasever/$basearch/
description: NGINX Repository
enabled: yes
gpgcheck: yes
when: ansible_distribution == "CentOS"
- name: "(Install: Amazon Linux) Add NGINX Unit Repository"
yum_repository:
name: nginx
baseurl: https://packages.nginx.org/unit/amzn/$releasever/$basearch/
description: NGINX Repository
enabled: yes
gpgcheck: yes
when: ansible_distribution == "Amazon"