New feature: install nginx from backports

pull/14/head
Emilien Mantel 2016-01-11 15:16:24 +01:00
parent d463b690ec
commit f64e1f1106
4 changed files with 14 additions and 5 deletions

View File

@ -10,12 +10,13 @@ SSL management will come later.
Requirements Requirements
------------ ------------
None. None. If you set true to `nginx_backports`, you must install backports repository before lauching this role.
Role Variables Role Variables
-------------- --------------
- `nginx_apt_package`: APT nginx package (try: apt-cache search ^nginx) - `nginx_apt_package`: APT nginx package (try: apt-cache search ^nginx)
- `nginx_backports`: Install nginx from backport repository (bool)
- `nginx_root`: root directory where you want to have your files - `nginx_root`: root directory where you want to have your files
- `nginx_log_dir`: log directory (if you change it, don't forget to change logrotate config) - `nginx_log_dir`: log directory (if you change it, don't forget to change logrotate config)
- `nginx_ssl_dir`: directory where you install your SSL/TLS keys - `nginx_ssl_dir`: directory where you install your SSL/TLS keys

View File

@ -1,6 +1,7 @@
--- ---
nginx_apt_package: nginx-full nginx_apt_package: nginx-full
nginx_backports: false
# #
# Nginx shared variables # Nginx shared variables

View File

@ -1,10 +1,15 @@
--- ---
- name: APT | Install nginx and dependencies - name: APT | Install nginx and dependencies
apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600 apt: >
with_items: pkg={{ nginx_apt_package }}
- "{{ nginx_apt_package }}" state=present
- python-passlib update_cache=yes
cache_valid_time=3600
default_release={{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}
- name: APT | Install python-passlib
apt: pkg=python-passlib state=present
- name: SHELL | Get Nginx version - name: SHELL | Get Nginx version
shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1 shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1

View File

@ -2,6 +2,7 @@
- hosts: all - hosts: all
pre_tasks: pre_tasks:
- apt_repository: repo='deb http://httpredir.debian.org/debian {{ ansible_distribution_release }}-backports main' state=present
- apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present - apt: pkg={{ item }} update_cache=yes cache_valid_time=3600 state=present
with_items: with_items:
- php5-fpm - php5-fpm
@ -10,6 +11,7 @@
- service: name=fcgiwrap state=started - service: name=fcgiwrap state=started
- pause: seconds=5 - pause: seconds=5
vars: vars:
nginx_backports: true
nginx_php: true nginx_php: true
nginx_upstreams: nginx_upstreams:
- name: 'test' - name: 'test'