59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
---
|
|
- name: Copy the nginx configuration file
|
|
template:
|
|
src: nginx.conf.j2
|
|
dest: "{{ nginx_conf_dir }}/nginx.conf"
|
|
notify:
|
|
- restart nginx
|
|
|
|
- name: Ensure auth_basic files created
|
|
template:
|
|
src: auth_basic.j2
|
|
dest: "{{ nginx_conf_dir }}/auth_basic/{{ item.key }}"
|
|
mode: 0750
|
|
with_dict: "{{ nginx_auth_basic_files }}"
|
|
|
|
- name: Create the configurations for sites
|
|
template:
|
|
src: "{{ item.value.template | default(nginx_default_site_template) }}"
|
|
dest: "{{ nginx_conf_dir }}/sites-available/{{ item.key }}.conf"
|
|
with_dict: "{{ nginx_sites }}"
|
|
when: item.key not in nginx_remove_sites
|
|
notify:
|
|
- reload nginx
|
|
|
|
- name: Create links for sites-enabled
|
|
file:
|
|
state: link
|
|
src: "{{ nginx_conf_dir }}/sites-available/{{ item.key }}.conf"
|
|
dest: "{{ nginx_conf_dir }}/sites-enabled/{{ item.key }}.conf"
|
|
with_dict: "{{ nginx_sites }}"
|
|
when: item.key not in nginx_remove_sites
|
|
notify:
|
|
- reload nginx
|
|
|
|
- name: Create the configurations for independent config file
|
|
template:
|
|
src: config.conf.j2
|
|
dest: "{{ nginx_conf_dir }}/conf.d/{{ item.key }}.conf"
|
|
with_dict: "{{ nginx_configs }}"
|
|
notify:
|
|
- reload nginx
|
|
|
|
- name: Create configuration snippets
|
|
template:
|
|
src: config.conf.j2
|
|
dest: "{{ nginx_conf_dir }}/snippets/{{ item.key }}.conf"
|
|
with_dict: "{{ nginx_snippets }}"
|
|
notify:
|
|
- reload nginx
|
|
|
|
- name: Create the configurations for independent config file for streams
|
|
template:
|
|
src: "{{ item.value.template | default('config_stream.conf.j2') }}"
|
|
dest: "{{ nginx_conf_dir }}/conf.d/stream/{{ item.key }}.conf"
|
|
with_dict: "{{ nginx_stream_configs }}"
|
|
notify:
|
|
- reload nginx
|
|
when: nginx_stream_params or nginx_stream_configs
|