mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-06-22 09:55:03 +02:00
Fixes #10: Better organize os-specific tasks.
This commit is contained in:
parent
7e6a17cc4d
commit
66922e9951
|
@ -1,3 +1,3 @@
|
|||
---
|
||||
- name: restart nginx
|
||||
command: service nginx restart
|
||||
service: name=nginx state=restarted
|
||||
|
|
|
@ -8,24 +8,14 @@
|
|||
nginx_user: "{{ __nginx_user }}"
|
||||
when: nginx_user is not defined
|
||||
|
||||
# Nginx setup.
|
||||
- name: Enable nginx repo (RedHat).
|
||||
template:
|
||||
src: nginx.repo.j2
|
||||
dest: /etc/yum.repos.d/nginx.repo
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Ensure nginx is installed (RedHat).
|
||||
yum: pkg=nginx state=installed enablerepo=nginx
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Ensure nginx is installed (Debian).
|
||||
apt: pkg=nginx state=installed
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
# Nginx setup.
|
||||
- name: Copy nginx configuration in place.
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
|
|
3
tasks/setup-Debian.yml
Normal file
3
tasks/setup-Debian.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
- name: Ensure nginx is installed.
|
||||
apt: pkg=nginx state=installed
|
11
tasks/setup-RedHat.yml
Normal file
11
tasks/setup-RedHat.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
- name: Enable nginx repo.
|
||||
template:
|
||||
src: nginx.repo.j2
|
||||
dest: /etc/yum.repos.d/nginx.repo
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
|
||||
- name: Ensure nginx is installed.
|
||||
yum: pkg=nginx state=installed enablerepo=nginx
|
Loading…
Reference in New Issue
Block a user