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

View File

@ -30,7 +30,7 @@ server {
{% endif %} {% endif %}
{% if 'https' in __proto %} {% if 'https' in __proto %}
{% for port in __listen_ssl %} {% 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 %} {% endfor %}
{{ ssl(item.ssl_name) }} {{ ssl(item.ssl_name) }}
include {{ nginx_helper_dir + '/ssl-' + item.ssl_template | default('strong') }}; include {{ nginx_helper_dir + '/ssl-' + item.ssl_template | default('strong') }};

View File

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

View File

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

View File

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