mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-26 09:12:09 +07:00
Dynamic module management (closes #23)
This commit is contained in:
16
tasks/dyn_modules.yml
Normal file
16
tasks/dyn_modules.yml
Normal 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
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user