Fix check HTTP2 on FreeBSD (multi-OS code)

pull/22/head
Emilien Mantel 2016-03-08 19:37:39 +01:00
parent 29a40fc0a8
commit 2cfda9a930
5 changed files with 20 additions and 10 deletions

View File

@ -2,14 +2,22 @@
- 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
- name: SHELL | Get module list
shell: nginx -V 2>&1 | tr -- - '\n' | grep -A 1 with | grep _module | sed -r 's/_module\s*$//g' |sort
register: nginx_modules
shell: nginx -V 2>&1 | tr -- - '\n' | grep -A 1 with | grep _module | sed 's/_module[[:space:]]*//g' | sort
args:
executable: /bin/sh
register: shell_modules
changed_when: false
- name: SET_FACT | Save modules
set_fact:
nginx_modules: "{{ shell_modules.stdout_lines }}"
- name: FILE | Create folders
file: dest={{ item }} owner=root mode=0755 state=directory
with_items: "{{ nginx_dirs }}"

View File

@ -30,7 +30,7 @@ server {
{% endif %}
{% if 'https' in __proto %}
{% for port in __listen_ssl %}
listen {{ port }}{% if nginx_default_vhost_ssl == __main_name %} default_server{% endif %} ssl{% if nginx_auto_config_httpv2 and 'http_v2' in nginx_modules.stdout_lines %} http2{% endif %};
listen {{ port }}{% if nginx_default_vhost_ssl == __main_name %} default_server{% endif %} ssl{% if nginx_auto_config_httpv2 and 'http_v2' in nginx_modules %} http2{% endif %};
{% endfor %}
{{ ssl(item.ssl_name) }}
include {{ nginx_helper_dir + '/ssl-' + item.ssl_template | default('strong') }};

View File

@ -9,6 +9,7 @@
- php5-fpm
- curl
- fcgiwrap
- nghttp2
- name: SERVICE | Force start services
service: name={{ item }} state=started

View File

@ -2,6 +2,7 @@
- name: SET_FACT | FreeBSD web user
set_fact:
nginx_pkgng_package: 'nginx-devel'
nginx_user: 'www'
nginx_php_sockets:
- host: '127.0.0.1'
@ -13,6 +14,7 @@
- php56
- curl
- fcgiwrap
- nghttp2
- name: SERVICE | Force start services
service: name={{ item }} state=started enabled=yes

View File

@ -328,10 +328,9 @@
# --------------------------------
# Check HTTP2
# --------------------------------
- block:
- name: APT | Install nghttp2
apt: pkg=nghttp2 state=present
- name: SHELL | Check HTTP2
shell: nghttp -nv https://localhost 2> /dev/null | grep -q h2
changed_when: false
when: nginx_auto_config_httpv2 and 'http_v2' in nginx_modules.stdout_lines
- name: SHELL | Check HTTP2
shell: nghttp -nv https://localhost 2> /dev/null | grep -q h2
args:
executable: /bin/sh
changed_when: false
when: nginx_auto_config_httpv2 and 'http_v2' in nginx_modules