Refactor NGINX Unit packages into a separate file

This commit is contained in:
Alessandro Fael Garcia 2018-05-10 13:03:22 -07:00
parent 0ed9afb71a
commit ce880e5731
2 changed files with 90 additions and 88 deletions

View File

@ -0,0 +1,88 @@
- name: "(Install: CentOS) Install NGINX Unit Packages"
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: RedHat 6) Install NGINX Unit Packages"
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: RedHat 7) Install NGINX Unit Packages"
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 == 7
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: Amazon Linux) Install NGINX Unit Packages"
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: Debian Jessie) 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: Debian Stretch) 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 == "Debian" and ansible_distribution_major_version|int == 9
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: Ubuntu) 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"

View File

@ -11,91 +11,5 @@
state: present state: present
notify: "(Handler: All OSs) Start NGINX Unit" notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: CentOS) Install NGINX Unit Packages" - import_tasks: install-packages.yml
package: when: unit_packages
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python
- unit-go
- unit-perl
when: ansible_distribution == "CentOS" and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: RedHat) Install NGINX Unit Packages"
package:
name: "{{ item }}"
state: present
with_items:
- unit-php
- unit-python
- unit-perl
when: ansible_distribution == "RedHat" and ansible_distribution_major_version|int == 6 and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: RedHat) Install NGINX Unit Packages"
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 == 7 and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: Amazon Linux) Install NGINX Unit Packages"
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: Debian 8) 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 and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: Debian 9) 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 == "Debian" and ansible_distribution_major_version|int == 9 and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"
- name: "(Install: Ubuntu) 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 and unit_packages
notify: "(Handler: All OSs) Start NGINX Unit"