ansible-role-nginx-config-svc/tasks/main.yml

19 lines
618 B
YAML
Raw Normal View History

2023-03-14 15:38:06 +00:00
---
- name: check if the config already exists
ansible.builtin.stat:
path: "/etc/nginx/http.d/{{ instance_name | default(ansible_play_name) }}.conf"
get_mime: false
get_checksum: false
get_attributes: false
when: onlyifnotexist is defined and onlyifnotexist
register: cnf
- name: configure nginx for {{ instance_name | default(ansible_play_name) }}
2023-03-14 15:38:06 +00:00
template:
src: nginx.conf.j2
dest: "/etc/nginx/http.d/{{ instance_name | default(ansible_play_name) }}.conf"
2023-03-14 15:38:06 +00:00
mode: 0644
when: onlyifnotexist is not defined or not onlyifnotexist or not cnf.stat.exists
2023-03-14 15:38:06 +00:00
notify:
- reload nginx