Fixes #10: Better organize os-specific tasks.

pull/15/head
Jeff Geerling 8 years ago
parent 7e6a17cc4d
commit 66922e9951
  1. 2
      handlers/main.yml
  2. 18
      tasks/main.yml
  3. 3
      tasks/setup-Debian.yml
  4. 11
      tasks/setup-RedHat.yml

@ -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
when: ansible_os_family == 'RedHat'
- name: Ensure nginx is installed (RedHat).
yum: pkg=nginx state=installed enablerepo=nginx
# Setup/install tasks.
- include: setup-RedHat.yml
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

@ -0,0 +1,3 @@
---
- name: Ensure nginx is installed.
apt: pkg=nginx state=installed

@ -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