mirror of
https://github.com/geerlingguy/ansible-role-nginx.git
synced 2024-11-09 09:40:09 +01:00
Add optional vhost_filename option to nginx_vhosts
This commit is contained in:
parent
235a0053a7
commit
98b736f479
@ -29,6 +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"
|
||||
extra_parameters: |
|
||||
location ~ \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
|
@ -60,6 +60,7 @@ nginx_vhosts: []
|
||||
# server_name_redirect: "www.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.
|
||||
#
|
||||
# # Properties that are only added if defined:
|
||||
# error_page: ""
|
||||
|
@ -15,7 +15,7 @@
|
||||
- name: Add managed vhost config files.
|
||||
template:
|
||||
src: "{{ item.template|default(nginx_vhost_template) }}"
|
||||
dest: "{{ nginx_vhost_path }}/{{ item.server_name.split(' ')[0] }}.conf"
|
||||
dest: "{{ nginx_vhost_path }}/{{ item.vhost_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.server_name.split(' ')[0] }}.conf"
|
||||
path: "{{ nginx_vhost_path }}/{{ item.vhost_filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
|
||||
state: absent
|
||||
when: item.state|default('present') == 'absent'
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
|
Loading…
Reference in New Issue
Block a user