77 lines
2.1 KiB
YAML
Executable File
77 lines
2.1 KiB
YAML
Executable File
---
|
|
- name: Delete default nginx site configuration
|
|
ansible.builtin.file:
|
|
path: "{{ nginx_site_config_path }}/default"
|
|
state: absent
|
|
when: nginx_delete_default_site_config
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Add all the template site configurations
|
|
ansible.builtin.template:
|
|
src: "{{ item.template_path | default(nginx_site_config_template) }}"
|
|
dest: "{{ nginx_site_config_path }}/{{ item.name }}"
|
|
owner: root
|
|
mode: "0644"
|
|
when: item.conf_file is undefined
|
|
loop: "{{ nginx_sites }}"
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Add all site configs using custom files
|
|
ansible.builtin.copy:
|
|
src: "{{ item.conf_file }}"
|
|
dest: "{{ nginx_site_config_path }}/{{ item.name }}"
|
|
owner: root
|
|
mode: "0644"
|
|
when: item.conf_file is defined
|
|
loop: "{{ nginx_sites }}"
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Manage symlinks for sites
|
|
ansible.builtin.file:
|
|
src: "{{ nginx_site_config_path }}/{{ item.name }}"
|
|
dest: "{{ nginx_site_enabled_path }}/{{ item.name }}"
|
|
state: "{{ (item.enabled | default(nginx_site_enabled_by_default)) | ternary('link', 'absent') }}"
|
|
loop: "{{ nginx_sites }}"
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Copy over configuration snippets
|
|
ansible.builtin.copy:
|
|
src: "snippets/{{ item }}"
|
|
dest: "{{ nginx_snippets_path }}/{{ item }}"
|
|
owner: root
|
|
mode: "0644"
|
|
loop: "{{ nginx_snippets }}"
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Render templated conf.d files
|
|
ansible.builtin.template:
|
|
src: "conf.d/{{ item }}.j2"
|
|
dest: "{{ nginx_conf_d_path }}/{{ item }}"
|
|
owner: root
|
|
mode: "0644"
|
|
loop: "{{ nginx_conf_d_templates }}"
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|
|
|
|
- name: Add the main nginx configuration
|
|
ansible.builtin.copy:
|
|
src: nginx.conf
|
|
dest: /etc/nginx/nginx.conf
|
|
owner: root
|
|
mode: "0644"
|
|
validate: 'nginx -t -c %s'
|
|
notify:
|
|
- Validate nginx configuration
|
|
- Reload nginx
|