Meilleure gestion des dossiers et htpasswd par location

This commit is contained in:
Emilien Mantel
2015-12-03 16:32:08 +01:00
parent 0d65cd3c5c
commit c0f2d694e7
9 changed files with 100 additions and 14 deletions

View File

@@ -15,6 +15,19 @@
max_conns: 150
weight: 10
down: false
nginx_htpasswd:
- name: 'hello'
description: 'Please login!'
users:
- name: 'hx'
password: 'asdfg'
state: 'absent'
- name: 'hanx'
password: 'qwerty'
- name: 'deleteme'
description: 'Please login!'
users: []
state: 'absent'
nginx_vhosts:
- name:
- 'test.local'
@@ -30,6 +43,16 @@
- 'return 403;'
'/gunther':
- 'return 404;'
- name: 'test-htpasswd.local'
template: '_base'
location:
'/hello':
- htpasswd: 'hello'
- 'default_type "text/html; charset=UTF-8";'
- 'echo hello;'
- name: 'test-htpasswd-all.local'
template: '_base'
htpasswd: 'hello'
- name: 'test-location.local'
template: '_base'
location:
@@ -78,3 +101,18 @@
changed_when: false
register: r
failed_when: r.stdout.find('301 Moved Permanently') == -1
- name: -- VERIFY AUTH BASIC NONE --
command: "curl -H 'Host: test-htpasswd.local' http://127.0.0.1/hello"
changed_when: false
register: authnone
failed_when: authnone.stdout.find('401 Authorization Required') == -1
- name: -- VERIFY AUTH BASIC FAIL --
command: "curl -u fail:fail -H 'Host: test-htpasswd.local' http://127.0.0.1/hello"
changed_when: false
register: authfail
failed_when: authfail.stdout.find('401 Authorization Required') == -1
- name: -- VERIFY AUTH BASIC OK --
command: "curl -u hanx:qwerty -H 'Host: test-htpasswd.local' http://127.0.0.1/hello"
changed_when: false
register: authok
failed_when: authok.stdout.find('hello') == -1