Define a sane default in case instance_name is not defined
This commit is contained in:
parent
d80a92e417
commit
ff9922aba4
@ -1,17 +1,17 @@
|
|||||||
---
|
---
|
||||||
- name: check if the config already exists
|
- name: check if the config already exists
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "/etc/nginx/http.d/{{ instance_name }}.conf"
|
path: "/etc/nginx/http.d/{{ instance_name | default(ansible_play_name) }}.conf"
|
||||||
get_mime: false
|
get_mime: false
|
||||||
get_checksum: false
|
get_checksum: false
|
||||||
get_attributes: false
|
get_attributes: false
|
||||||
when: onlyifnotexist is defined and onlyifnotexist
|
when: onlyifnotexist is defined and onlyifnotexist
|
||||||
register: cnf
|
register: cnf
|
||||||
|
|
||||||
- name: configure nginx for {{ instance_name }}
|
- name: configure nginx for {{ instance_name | default(ansible_play_name) }}
|
||||||
template:
|
template:
|
||||||
src: nginx.conf.j2
|
src: nginx.conf.j2
|
||||||
dest: "/etc/nginx/http.d/{{ instance_name }}.conf"
|
dest: "/etc/nginx/http.d/{{ instance_name | default(ansible_play_name) }}.conf"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
when: onlyifnotexist is not defined or not onlyifnotexist or not cnf.stat.exists
|
when: onlyifnotexist is not defined or not onlyifnotexist or not cnf.stat.exists
|
||||||
notify:
|
notify:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user