2016-01-12 00:20:42 +07:00
---
2017-07-27 16:50:48 +07:00
- name : FAIL | Check possible issues
fail :
msg : "This ansible version ({{ ansible_version.full}}) is not compatible with your needs (Debian Stretch + htpasswd). Please see https://github.com/HanXHX/ansible-nginx/issues/28"
when :
2017-07-27 19:56:43 +07:00
ansible_distribution_major_version | version_compare('9', 'ge') and
2017-07-27 16:50:48 +07:00
ansible_version.full | version_compare('2.3.2', 'lt') and
nginx_htpasswd | length > 0
2016-03-07 17:59:26 +07:00
- name : APT | Update cache
2017-07-27 17:21:10 +07:00
apt :
update_cache : yes
cache_valid_time : 3600
2016-12-08 23:34:59 +07:00
changed_when : false
2016-02-10 00:36:48 +07:00
2016-08-11 15:25:45 +07:00
- name : APT | Force OpenSSL from backports (fix dependency break)
2017-07-27 17:21:10 +07:00
apt :
pkg : openssl
state : latest
default_release : "{{ ansible_distribution_release + '-backports' }}"
2016-08-11 15:25:45 +07:00
when : nginx_backports
2016-01-12 00:20:42 +07:00
- name : APT | Install nginx and dependencies
2017-07-27 17:21:10 +07:00
apt :
pkg : "{{ nginx_apt_package }}"
state : present
default_release : "{{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}"
2016-01-12 00:20:42 +07:00
2018-01-16 00:41:17 +07:00
- name : SHELL | Get Nginx version
shell : nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1
args :
executable : /bin/sh
register : nginx_version
changed_when : false
check_mode : no
2017-12-15 01:41:05 +07:00
- name : APT | Install nginx modules
apt :
2017-12-15 01:55:22 +07:00
pkg : "{{ item }}"
2017-12-15 01:41:05 +07:00
state : present
2017-12-15 01:55:22 +07:00
with_items : "{{ nginx_module_packages }}"
2018-01-16 04:33:55 +07:00
when : "{{ nginx_version.stdout | version_compare('1.9.11', 'ge')"
2017-12-15 01:41:05 +07:00
2016-01-12 00:20:42 +07:00
- name : APT | Install python-passlib
2017-07-27 17:21:10 +07:00
apt :
pkg : python-passlib
state : present