ansible-role-nginx/tasks/conf/template-config.yml

41 lines
1.2 KiB
YAML
Raw Normal View History

---
- name: "(Setup: All NGINX) Dynamically Generate NGINX Main Configuration File"
template:
src: nginx.conf.j2
dest: /etc/nginx/nginx.conf
backup: yes
when: main_template_enable
notify: "(Handler: All OSs) Reload NGINX"
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
2018-04-05 01:48:31 +02:00
file:
path: /etc/nginx/conf.d/http
state: directory
when: http_template_enable
- name: "(Setup: All NGINX) Dynamically Generate NGINX HTTP Configuration Files"
template:
src: "{{ item }}"
2018-04-05 01:48:31 +02:00
dest: /etc/nginx/conf.d/http/{{ item | basename | regex_replace('\.j2','') }}
backup: yes
with_fileglob:
- "../templates/http/*.j2"
2018-04-05 01:48:31 +02:00
when: http_template_enable
notify: "(Handler: All OSs) Reload NGINX"
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
2018-04-05 01:48:31 +02:00
file:
path: /etc/nginx/conf.d/stream
state: directory
when: stream_template_enable
- name: "(Setup: All NGINX) Dynamically Generate NGINX Stream Configuration Files"
template:
src: "{{ item }}"
2018-04-05 01:48:31 +02:00
dest: /etc/nginx/conf.d/stream/{{ item | basename | regex_replace('\.j2','') }}
backup: yes
with_fileglob:
- "../templates/stream/*.j2"
2018-04-05 01:48:31 +02:00
when: stream_template_enable
notify: "(Handler: All OSs) Reload NGINX"