Fix proper usage of repsitory EL family. Add support for mainline nginx

pull/26/head
Werner Buck 9 years ago
parent a08f8cda11
commit 95e49ce2ee
  1. 4
      README.md
  2. 2
      defaults/main.yml
  3. 14
      tasks/setup-RedHat.yml
  4. 13
      templates/nginx.centos.repo.j2
  5. 5
      templates/nginx.repo.j2
  6. 13
      templates/nginx.rhel.repo.j2

@ -81,6 +81,10 @@ Set as the `proxy_cache_path` directive in the `nginx.conf` file. By default, th
(For Debian/Ubuntu only) Allows you to set a different repository for the installation of Nginx. As an example, if you are running Debian's wheezy release, and want to get a newer version of Nginx, you can install the `wheezy-backports` repository and set that value here, and Ansible will use that as the `-t` option while installing Nginx.
nginx_el_install_mainline: yes
(For Centos/Rhel only) Defaults to no. If true, installs the mainline nginx repository.
## Dependencies
None.

@ -1,6 +1,8 @@
---
# Used only for Debian/Ubuntu installation, as the -t option for apt.
nginx_default_release: ""
# Used only for RHEL/Centos installation. Set to false for mainline repo.
nginx_el_install_mainline: yes
nginx_worker_processes: "1"
nginx_worker_connections: "1024"

@ -1,11 +1,21 @@
---
- name: Enable nginx repo.
- name: (RedHat) Enable nginx repo.
template:
src: nginx.repo.j2
src: nginx.rhel.repo.j2
dest: /etc/yum.repos.d/nginx.repo
owner: root
group: root
mode: 0644
when: ansible_distribution == 'RedHat'
- name: (Centos) Enable nginx repo.
template:
src: nginx.centos.repo.j2
dest: /etc/yum.repos.d/nginx.repo
owner: root
group: root
mode: 0644
when: ansible_distribution == 'CentOS'
- name: Ensure nginx is installed.
yum: pkg=nginx state=installed enablerepo=nginx

@ -0,0 +1,13 @@
{% if nginx_el_install_mainline %}
[nginx]
name=nginx repo mainline
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
{% else %}
[nginx]
name=nginx repo stable
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
{% endif %}

@ -1,5 +0,0 @@
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/{{ ansible_distribution_major_version }}/$basearch/
gpgcheck=0
enabled=1

@ -0,0 +1,13 @@
{% if nginx_el_install_mainline %}
[nginx]
name=nginx repo mainline
baseurl=http://nginx.org/packages/mainline/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1
{% else %}
[nginx]
name=nginx repo stable
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1
{% endif %}