Renaming variables *vhost* -> *site*

Vhost is an Apache configuration, not Nginx.
Manages backward compatibility.
This commit is contained in:
Emilien Mantel
2017-04-25 12:27:08 +02:00
parent a60e81cc1f
commit cbdfc741ba
14 changed files with 83 additions and 68 deletions

View File

@@ -115,8 +115,9 @@
- ' DZ no;'
- ' TN no;'
- '}'
nginx_default_vhost: 'first-test'
nginx_default_vhost_ssl: 'test-ssl-predeployed.local'
nginx_default_site: 'first-test'
nginx_default_site_ssl: 'test-ssl-predeployed.local'
# TODO: nginx_vhosts -> nginx_sites (for now check backward compatibility)
nginx_vhosts:
- name:
- 'test.local'
@@ -255,13 +256,13 @@
# --------------------------------
- name: -- CHECK FACTS --
assert:
that: "'{{ ansible_local.nginx.fact_nginx_vhosts[0].name[0] }}' == 'test.local'"
that: "'{{ ansible_local.nginx.fact_nginx_sites[0].name[0] }}' == 'test.local'"
# --------------------------------
# Simple vhosts tests
# Simple sites tests
# --------------------------------
- name: -- VERIFY VHOSTS --
- name: -- VERIFY SITES --
command: "curl -H 'Host: {{ item.name if item.name is string else item.name[0] }}' http://127.0.0.1{% if item.listen is defined %}:{{ item.listen[0] }}{% endif %}/"
with_items: "{{ nginx_vhosts }}"
with_items: "{{ nginx_sites }}"
when: item.state is undefined or item.state != "absent"
changed_when: false
- name: -- VERIFY FORBIDDEN --
@@ -269,9 +270,9 @@
register: f
failed_when: f.stdout.find('403 Forbidden') == -1
changed_when: false
- name: -- VERIFY REDIRECT VHOSTS --
- name: -- VERIFY REDIRECT SITES --
command: "curl -H 'Host: {{ item.redirect_from[0] }}' http://127.0.0.1/"
with_items: "{{ nginx_vhosts }}"
with_items: "{{ nginx_sites }}"
when: item.redirect_from is defined and (item.state is undefined or item.state != "absent")
changed_when: false
register: r
@@ -280,7 +281,7 @@
# --------------------------------
# PHP
# --------------------------------
- name: -- VERIFY PHP5 VHOSTS (implicit default) --
- name: -- VERIFY PHP5 SITES (implicit default) --
command: "curl -H 'Host: {{ item }}' http://127.0.0.1/"
register: p
changed_when: false
@@ -288,7 +289,7 @@
with_items: ['test-php-index.local']
when: nginx_php56
- name: -- VERIFY PHP7 VHOSTS --
- name: -- VERIFY PHP7 SITES --
command: "curl -H 'Host: {{ item }}' http://127.0.0.1/"
register: p
changed_when: false
@@ -394,33 +395,33 @@
port: '8443'
# --------------------------------
# Default vhosts
# Default sites
# --------------------------------
- name: -- VERIFY DEFAULT VHOST --
- name: -- VERIFY DEFAULT SITE --
command: "curl -v http://127.0.0.1/"
changed_when: false
register: vdefault
failed_when: >
vdefault.stdout.find('Index HTML test OK') == -1 or
vdefault.stderr.find('X-ansible-default') == -1
- name: -- VERIFY DEFAULT SSL VHOST --
- name: -- VERIFY DEFAULT SSL SITE --
command: "curl --insecure -v https://127.0.0.1/"
changed_when: false
register: defaultssl
failed_when: >
defaultssl.stdout.find('Index HTML test OK') == -1 or
defaultssl.stderr.find('X-ansible-default') == -1
- name: -- VERIFY NOT DEFAULT VHOST --
- name: -- VERIFY NOT DEFAULT SITE --
command: "curl -v -H 'Host: test-php.local' http://127.0.0.1/"
changed_when: false
register: vphp
failed_when: vphp.stderr.find('X-ansible-default') != -1
- name: -- VERIFY NOT DEFAULT SSL VHOST --
- name: -- VERIFY NOT DEFAULT SSL SITE --
command: "curl --insecure -v -H 'Host: test-ssl.local' https://127.0.0.1/"
changed_when: false
register: notdefaultssl
failed_when: notdefaultssl.stderr.find('X-ansible-default') != -1
- name: -- VERIFY DEFAULT VHOST + STUB_STATUS --
- name: -- VERIFY DEFAULT SITE + STUB_STATUS --
command: "curl -v http://127.0.0.1/status"
changed_when: false
register: vdefault_status