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 : Main variables are :
* `nginx_minimal` : very basic install and config (default: `False`) ; * `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_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_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 ; * `nginx_private_htpasswd_present` : list of users to have in the private htpasswd ;

View file

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

View file

@ -1,10 +1,6 @@
--- ---
- include: packages_jessie.yml - include: packages.yml
when: ansible_distribution_release == "jessie"
- include: packages_stretch.yml
when: ansible_distribution_major_version | version_compare('9', '>=')
# TODO: find a way to override the main configuration # TODO: find a way to override the main configuration
# without touching the main file # 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" # TODO: install "nginx" + only necessary modules, instead of "nginx-full"
- name: Ensure Nginx is installed - name: Ensure Nginx is installed
@ -7,5 +9,5 @@
state: present state: present
notify: restart nginx notify: restart nginx
tags: tags:
- nginx - nginx
- packages - packages

View file

@ -7,8 +7,8 @@
- nginx - nginx
- packages - packages
- name: Prefer Nginx packages from jessie-backports - name: Prefer Nginx packages from backports
copy: template:
src: apt/nginx_preferences src: apt/nginx_preferences
dest: /etc/apt/preferences.d/999-nginx dest: /etc/apt/preferences.d/999-nginx
force: yes 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* Package: nginx nginx-* libnginx-* libssl*
Pin: release a=jessie-backports Pin: release a={{ ansible_distribution_release }}-backports
Pin-Priority: 999 Pin-Priority: 999