From bf57ad329a8fb3597168012f9df4738b10543d25 Mon Sep 17 00:00:00 2001 From: Ian Buchanan Date: Fri, 19 Jan 2018 15:49:39 -0600 Subject: [PATCH] Fixes 138: Support for not defining a server name by adding another layer of default --- tasks/vhosts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/vhosts.yml b/tasks/vhosts.yml index 05af037..9261967 100644 --- a/tasks/vhosts.yml +++ b/tasks/vhosts.yml @@ -15,7 +15,7 @@ - name: Add managed vhost config files. template: src: "{{ item.template|default(nginx_vhost_template) }}" - dest: "{{ nginx_vhost_path }}/{{ item.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}" + dest: "{{ nginx_vhost_path }}/{{ item.filename|default((item.server_name|default('nginx')).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.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}" + path: "{{ nginx_vhost_path }}/{{ item.filename|default((item.server_name|default('nginx')).split(' ')[0] ~ '.conf') }}" state: absent when: item.state|default('present') == 'absent' with_items: "{{ nginx_vhosts }}"