vhost_filename -> filename

pull/105/head
Oskar Schöldström 7 years ago
parent d227a1803c
commit 7b47c3de12
  1. 6
      README.md
  2. 2
      defaults/main.yml
  3. 4
      tasks/vhosts.yml

@ -29,7 +29,7 @@ A list of vhost definitions (server blocks) for Nginx virtual hosts. Each entry
error_log: ""
state: "present"
template: "{{ nginx_vhost_template }}"
vhost_filename: "example.com.conf"
filename: "example.com.conf"
extra_parameters: |
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
@ -50,11 +50,11 @@ Please take note of the indentation in the above block. The first line should be
- listen: "80"
server_name: "example.com www.example.com"
return "301 https://example.com$request_uri;"
vhost_filename: "example.com.80.conf"
filename: "example.com.80.conf"
An example of a secondary vhost which will redirect to the one shown above.
*Note: The `vhost_filename` defaults to the first domain in `server_name`, if you have two vhosts with the same domain, eg. a redirect, you need to manually set the `vhost_filename` so the second one doesn't override the first one*
*Note: The `filename` defaults to the first domain in `server_name`, if you have two vhosts with the same domain, eg. a redirect, you need to manually set the `filename` so the second one doesn't override the first one*
nginx_remove_default_vhost: false

@ -59,7 +59,7 @@ nginx_vhosts: []
# server_name: "example.com" # default: N/A
# root: "/var/www/example.com" # default: N/A
# index: "index.html index.htm" # default: "index.html index.htm"
# vhost_filename: "example.com.conf" # Can be used to set the filename of the vhost file.
# filename: "example.com.conf" # Can be used to set the filename of the vhost file.
#
# # Properties that are only added if defined:
# server_name_redirect: "www.example.com" # default: N/A

@ -15,7 +15,7 @@
- name: Add managed vhost config files.
template:
src: "{{ item.template|default(nginx_vhost_template) }}"
dest: "{{ nginx_vhost_path }}/{{ item.vhost_filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
dest: "{{ nginx_vhost_path }}/{{ item.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
force: yes
owner: root
group: root
@ -26,7 +26,7 @@
- name: Remove managed vhost config files.
file:
path: "{{ nginx_vhost_path }}/{{ item.vhost_filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
path: "{{ nginx_vhost_path }}/{{ item.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
state: absent
when: item.state|default('present') == 'absent'
with_items: "{{ nginx_vhosts }}"