diff --git a/README.md b/README.md index 7738106..ad885c3 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,13 @@ SSL management will come later. Requirements ------------ -None. +None. If you set true to `nginx_backports`, you must install backports repository before lauching this role. Role Variables -------------- - `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_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 diff --git a/defaults/main.yml b/defaults/main.yml index 1e7843d..dc98a29 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,7 @@ --- nginx_apt_package: nginx-full +nginx_backports: false # # Nginx shared variables diff --git a/tasks/main.yml b/tasks/main.yml index aa928f0..8634412 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,15 @@ --- - name: APT | Install nginx and dependencies - apt: pkg={{ item }} state=latest update_cache=yes cache_valid_time=3600 - with_items: - - "{{ nginx_apt_package }}" - - python-passlib + apt: > + pkg={{ nginx_apt_package }} + state=present + 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 shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1 diff --git a/tests/test.yml b/tests/test.yml index efa1948..d9f5a3b 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -2,6 +2,7 @@ - hosts: all 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 with_items: - php5-fpm @@ -10,6 +11,7 @@ - service: name=fcgiwrap state=started - pause: seconds=5 vars: + nginx_backports: true nginx_php: true nginx_upstreams: - name: 'test'