mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-09-28 04:07:26 +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
|
- name: restart nginx
|
||||||
command: service nginx restart
|
service: name=nginx state=restarted
|
||||||
|
@ -8,24 +8,14 @@
|
|||||||
nginx_user: "{{ __nginx_user }}"
|
nginx_user: "{{ __nginx_user }}"
|
||||||
when: nginx_user is not defined
|
when: nginx_user is not defined
|
||||||
|
|
||||||
# Nginx setup.
|
# Setup/install tasks.
|
||||||
- name: Enable nginx repo (RedHat).
|
- include: setup-RedHat.yml
|
||||||
template:
|
|
||||||
src: nginx.repo.j2
|
|
||||||
dest: /etc/yum.repos.d/nginx.repo
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: 0644
|
|
||||||
when: ansible_os_family == 'RedHat'
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- name: Ensure nginx is installed (RedHat).
|
- include: setup-Debian.yml
|
||||||
yum: pkg=nginx state=installed enablerepo=nginx
|
|
||||||
when: ansible_os_family == 'RedHat'
|
|
||||||
|
|
||||||
- name: Ensure nginx is installed (Debian).
|
|
||||||
apt: pkg=nginx state=installed
|
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
# Nginx setup.
|
||||||
- name: Copy nginx configuration in place.
|
- name: Copy nginx configuration in place.
|
||||||
template:
|
template:
|
||||||
src: nginx.conf.j2
|
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