Dynamic module management (closes #23)

This commit is contained in:
Emilien Mantel
2016-10-12 18:13:59 +02:00
parent ef3440a015
commit 42bb4a3e2b
7 changed files with 41 additions and 1 deletions

16
tasks/dyn_modules.yml Normal file
View File

@@ -0,0 +1,16 @@
---
- name: FAIL | If Dynamic module is not available
fail: msg="{{ item }} dynamic module is not available"
with_items: "{{ nginx_dyn_modules }}"
when: "'{{ item }}=dynamic' not in nginx_modules"
- name: APT | Install nginx modules
apt: >
pkg="libnginx-mod-{{ item | replace('_', '-') }}"
state=present
default_release={{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}
with_items: "{{ nginx_dyn_modules }}"
when: ansible_distribution == 'Debian'
# TODO: manage freebsd

View File

@@ -9,6 +9,10 @@
- name: INCLUDE | Prepare
include: prepare.yml
- name: INCLUDE | Manage dynamic modules
include: dyn_modules.yml
when: nginx_version.stdout | version_compare('1.9.1', 'ge')
- name: INCLUDE | Install
include: config.yml

View File

@@ -8,7 +8,7 @@
changed_when: false
- name: SHELL | Get module list
shell: nginx -V 2>&1 | tr -- - '\n' | grep -A 1 with | grep _module | sed 's/_module[[:space:]]*//g' | sort
shell: nginx -V 2>&1 | tr -- - '\n' | grep -A 1 with | grep _module | sed -r 's/_module//g; s/\s+//g' | sort
args:
executable: /bin/sh
register: shell_modules