Cleanup - This nginx role now works across RedHat and Debian.

pull/3/head 1.1.0
Jeff Geerling 10 years ago
parent 373d428ad1
commit 45713939ee
  1. 8
      README.md
  2. 6
      meta/main.yml
  3. 15
      tasks/main.yml

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

@ -11,6 +11,12 @@ galaxy_info:
- name: EL
versions:
- 6
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all
categories:
- development
- web

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