Fix tests for Debian Stretch

- nagios is not available
- curl can use HTTP2 (headers are lowercase)
- bypass tests when htpasswd is empty (bypass issue #28)
pull/35/head
Emilien Mantel 2017-07-27 14:25:22 +02:00
parent 6935404939
commit e83395271d
2 changed files with 61 additions and 44 deletions

View File

@ -1,11 +1,19 @@
--- ---
- name: APT | Install web apps - name: APT | Install webapps
apt: pkg={{ item }} state=present install_recommends=no apt:
pkg: "{{ item }}"
state: present
install_recommends: no
with_items: with_items:
- backuppc - backuppc
- nagios3
# - owncloud # - owncloud
- name: APT | Install nagios3 (only on old Debian releases)
apt:
pkg: nagios3
state: present
when: ansible_distribution_major_version < 9
- name: SERVICE | Ensure backuppc is started - name: SERVICE | Ensure backuppc is started
service: name=backuppc state=started service: name=backuppc state=started

View File

@ -316,6 +316,9 @@
# -------------------------------- # --------------------------------
# Basic Auth # Basic Auth
# -------------------------------- # --------------------------------
- block:
- name: -- VERIFY AUTH BASIC NONE -- - name: -- VERIFY AUTH BASIC NONE --
command: "curl -H 'Host: test-htpasswd.local' http://127.0.0.1/hello/" command: "curl -H 'Host: test-htpasswd.local' http://127.0.0.1/hello/"
changed_when: false changed_when: false
@ -346,6 +349,8 @@
register: authgok register: authgok
failed_when: authgok.stdout.find('401 Authorization Required') != -1 failed_when: authgok.stdout.find('401 Authorization Required') != -1
when: nginx_htpasswd | length > 0
# -------------------------------- # --------------------------------
# BackupPC # BackupPC
# -------------------------------- # --------------------------------
@ -357,8 +362,10 @@
when: ansible_distribution != 'FreeBSD' when: ansible_distribution != 'FreeBSD'
# -------------------------------- # --------------------------------
# Nagios # Nagios (not avaiblable on Debian >= 9)
# -------------------------------- # --------------------------------
- block:
- name: -- VERIFY NAGIOS3 PHP -- - name: -- VERIFY NAGIOS3 PHP --
command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/side.php" command: "curl -u nagiosadmin:nagios -H 'Host: nagios3.local' http://127.0.0.1/side.php"
changed_when: false changed_when: false
@ -371,6 +378,8 @@
register: nagios_cgi register: nagios_cgi
failed_when: nagios_cgi.stdout.find('Nagios Event Summary') == -1 failed_when: nagios_cgi.stdout.find('Nagios Event Summary') == -1
when: ansible_distribution_major_version < 9
# -------------------------------- # --------------------------------
# Owncloud # Owncloud
# -------------------------------- # --------------------------------
@ -425,7 +434,7 @@
register: vdefault register: vdefault
failed_when: > failed_when: >
vdefault.stdout.find('Index HTML test OK') == -1 or vdefault.stdout.find('Index HTML test OK') == -1 or
vdefault.stderr.find('X-ansible-default') == -1 vdefault.stderr.lower().find('x-ansible-default') == -1
- name: -- VERIFY DEFAULT SSL SITE -- - name: -- VERIFY DEFAULT SSL SITE --
command: "curl --insecure -v https://127.0.0.1/" command: "curl --insecure -v https://127.0.0.1/"
@ -433,26 +442,26 @@
register: defaultssl register: defaultssl
failed_when: > failed_when: >
defaultssl.stdout.find('Index HTML test OK') == -1 or defaultssl.stdout.find('Index HTML test OK') == -1 or
defaultssl.stderr.find('X-ansible-default') == -1 defaultssl.stderr.lower().find('x-ansible-default') == -1
- name: -- VERIFY NOT DEFAULT SITE -- - name: -- VERIFY NOT DEFAULT SITE --
command: "curl -v -H 'Host: test-php.local' http://127.0.0.1/" command: "curl -v -H 'Host: test-php.local' http://127.0.0.1/"
changed_when: false changed_when: false
register: vphp register: vphp
failed_when: vphp.stderr.find('X-ansible-default') != -1 failed_when: vphp.stderr.lower().find('x-ansible-default') != -1
- name: -- VERIFY NOT DEFAULT SSL SITE -- - name: -- VERIFY NOT DEFAULT SSL SITE --
command: "curl --insecure -v -H 'Host: test-ssl.local' https://127.0.0.1/" command: "curl --insecure -v -H 'Host: test-ssl.local' https://127.0.0.1/"
changed_when: false changed_when: false
register: notdefaultssl register: notdefaultssl
failed_when: notdefaultssl.stderr.find('X-ansible-default') != -1 failed_when: notdefaultssl.stderr.lower().find('x-ansible-default') != -1
- name: -- VERIFY DEFAULT SITE + STUB_STATUS -- - name: -- VERIFY DEFAULT SITE + STUB_STATUS --
command: "curl -v http://127.0.0.1/status" command: "curl -v http://127.0.0.1/status"
changed_when: false changed_when: false
register: vdefault_status register: vdefault_status
failed_when: > failed_when: >
vdefault_status.stderr.find('X-ansible-default') == -1 or vdefault_status.stderr.lower().find('x-ansible-default') == -1 or
vdefault_status.stdout.find('Active connections') == -1 vdefault_status.stdout.find('Active connections') == -1
# -------------------------------- # --------------------------------