From 45713939ee121b69b9094d8f2cd9768543c44028 Mon Sep 17 00:00:00 2001 From: Jeff Geerling Date: Sun, 3 Aug 2014 21:24:54 -0500 Subject: [PATCH] Cleanup - This nginx role now works across RedHat and Debian. --- README.md | 8 ++------ meta/main.yml | 6 ++++++ tasks/main.yml | 15 ++++++++------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 907bd2b..8180a74 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Ansible Role: Nginx -Installs Nginx on RedHat/CentOS linux servers. +Installs Nginx on RedHat/CentOS or Debian/Ubuntu linux servers. -This role installs and configures the latest version of Nginx direct from the Nginx yum repository. You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside `/etc/nginx/conf.d/`, describing the location and options to use for your particular website. +This role installs and configures the latest version of Nginx from the Nginx yum repository (on RedHat-based systems) or via apt (on Debian-based systems). You will likely need to do extra setup work after this role has installed Nginx, like adding your own [virtualhost].conf file inside `/etc/nginx/conf.d/`, describing the location and options to use for your particular website. ## Requirements @@ -39,10 +39,6 @@ None. roles: - { role: geerlingguy.nginx } -## TODO - - - Make this role work with all flavors of linux (as supported by nginx repos). - ## License MIT / BSD diff --git a/meta/main.yml b/meta/main.yml index 7d7c8bf..033840b 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -11,6 +11,12 @@ galaxy_info: - name: EL versions: - 6 + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - all categories: - development - web diff --git a/tasks/main.yml b/tasks/main.yml index 6706d7a..fe3ef2d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,16 +1,17 @@ --- -- name: Enable nginx repo. - copy: src=nginx.repo dest=/etc/yum.repos.d/nginx.repo owner=root group=root mode=644 +- name: Enable nginx repo (RedHat). + copy: > + src=nginx.repo + dest=/etc/yum.repos.d/nginx.repo + owner=root group=root mode=644 when: ansible_os_family == 'RedHat' -- name: Ensure nginx is installed. +- name: Ensure nginx is installed (RedHat). yum: pkg=nginx state=installed enablerepo=nginx when: ansible_os_family == 'RedHat' -- name: Ensure nginx is installed. - apt: pkg=nginx state=installed update_cache=true - notify: - - restart nginx +- name: Ensure nginx is installed (Debian). + apt: pkg=nginx state=installed when: ansible_os_family == 'Debian' - name: Copy nginx configuration in place.