Initial commit
This commit is contained in:
Executable
+76
@@ -0,0 +1,76 @@
|
||||
---
|
||||
- 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
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Install NGINX
|
||||
ansible.builtin.apt:
|
||||
name: nginx
|
||||
state: present
|
||||
update_cache: true
|
||||
cache_valid_time: 3600
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
---
|
||||
- ansible.builtin.include_tasks: install_nginx.yaml
|
||||
- ansible.builtin.include_tasks: configure_nginx.yaml
|
||||
Reference in New Issue
Block a user