Nginx role now handle Nginx installation from backports for either Debian Jessie or Stretch

This commit is contained in:
Tristan PILAT 2018-07-31 16:05:47 +02:00
parent 57cf0a29ab
commit b095f87f85
7 changed files with 11 additions and 24 deletions

View File

@ -17,7 +17,7 @@ The regular mode is for full fledged web services with optimized defaults.
Main variables are :
* `nginx_minimal` : very basic install and config (default: `False`) ;
* `nginx_jessie_backports` : on Debian Jessie, we can prefer v1.10 from backports (default: `False`) ;
* `nginx_backports` : we can prefer higher version from backports (default: `False`) ;
* `nginx_ipaddr_whitelist_present` : list of IP addresses to have in the private whitelist ;
* `nginx_ipaddr_whitelist_absent` : list of IP addresses **not** to have in the whitelist ;
* `nginx_private_htpasswd_present` : list of users to have in the private htpasswd ;

View File

@ -1,7 +1,7 @@
---
nginx_minimal: False
nginx_jessie_backports: False
nginx_backports: False
nginx_package_name: "nginx-full"

View File

@ -1,10 +1,6 @@
---
- include: packages_jessie.yml
when: ansible_distribution_release == "jessie"
- include: packages_stretch.yml
when: ansible_distribution_major_version | version_compare('9', '>=')
- include: packages.yml
# TODO: find a way to override the main configuration
# without touching the main file

View File

@ -1,4 +1,6 @@
---
- include: packages_backports.yml
when: nginx_backports
# TODO: install "nginx" + only necessary modules, instead of "nginx-full"
- name: Ensure Nginx is installed
@ -7,5 +9,5 @@
state: present
notify: restart nginx
tags:
- nginx
- packages
- nginx
- packages

View File

@ -7,8 +7,8 @@
- nginx
- packages
- name: Prefer Nginx packages from jessie-backports
copy:
- name: Prefer Nginx packages from backports
template:
src: apt/nginx_preferences
dest: /etc/apt/preferences.d/999-nginx
force: yes

View File

@ -1,11 +0,0 @@
- include: packages_jessie_backports.yml
when: ansible_distribution_release == "jessie" and nginx_jessie_backports
- name: Ensure Nginx is installed
apt:
name: "{{ nginx_package_name }}"
state: present
notify: restart nginx
tags:
- nginx
- packages

View File

@ -1,3 +1,3 @@
Package: nginx nginx-* libnginx-* libssl*
Pin: release a=jessie-backports
Pin: release a={{ ansible_distribution_release }}-backports
Pin-Priority: 999