ansible-role-nginx/tasks/conf/template-config.yml
Alessandro Fael Garcia 13a847234e Refactor templating
* Add more advanced HTTP templating options
* Let users choose the upload destination when uploading files
* Implement the ability to print your NGINX configuration to your terminal after running a playbook
2018-10-16 11:52:04 -07:00

55 lines
1.9 KiB
YAML

---
- name: "(Setup: All NGINX) Ensure HTML Directory Exists"
file:
path: "{{ item.value.html_file_location }}"
state: directory
with_dict: "{{ nginx_html_demo_template }}"
when: nginx_html_demo_template_enable
- name: "(Setup: All NGINX) Dynamically Generate HTML Files"
template:
src: "{{ item.value.template_file }}"
dest: "{{ item.value.html_file_location }}/{{ item.value.html_file_name }}"
with_dict: "{{ nginx_html_demo_template }}"
when: nginx_html_demo_template_enable
- name: "(Setup: All NGINX) Dynamically Generate NGINX Main Configuration File"
template:
src: "{{ nginx_main_template.template_file }}"
dest: "{{ nginx_main_template.conf_file_location }}/{{ nginx_main_template.conf_file_name }}"
backup: yes
when: nginx_main_template_enable
notify: "(Handler: All OSs) Reload NGINX"
- name: "(Setup: All NGINX) Ensure NGINX HTTP Directory Exists"
file:
path: "{{ item.value.conf_file_location }}"
state: directory
with_dict: "{{ nginx_http_template }}"
when: nginx_http_template_enable
- name: "(Setup: All NGINX) Dynamically Generate NGINX HTTP Configuration Files"
template:
src: "{{ item.value.template_file }}"
dest: "{{ item.value.conf_file_location }}/{{ item.value.conf_file_name }}"
backup: yes
with_dict: "{{ nginx_http_template }}"
when: nginx_http_template_enable
notify: "(Handler: All OSs) Reload NGINX"
- name: "(Setup: All NGINX) Ensure NGINX Stream Directory Exists"
file:
path: /etc/nginx/conf.d/stream
state: directory
when: nginx_stream_template_enable
- name: "(Setup: All NGINX) Dynamically Generate NGINX Stream Configuration Files"
template:
src: "{{ item }}"
dest: /etc/nginx/conf.d/stream/{{ item | basename | regex_replace('\.j2','') }}
backup: yes
with_fileglob:
- "../templates/stream/*.j2"
when: nginx_stream_template_enable
notify: "(Handler: All OSs) Reload NGINX"