2016-01-12 00:20:42 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: TEMPLATE | Deploy nginx.conf
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.template:
|
2017-07-27 17:21:10 +07:00
|
|
|
src: "etc/nginx/nginx.conf.j2"
|
|
|
|
dest: "{{ nginx_etc_dir }}/nginx.conf"
|
2021-09-01 16:45:44 +07:00
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2022-11-25 15:52:40 +07:00
|
|
|
notify: Reload nginx
|
2016-01-12 00:20:42 +07:00
|
|
|
|
|
|
|
- name: TEMPLATE | Deploy all helpers
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.template:
|
2017-07-27 17:21:10 +07:00
|
|
|
src: "{{ item }}"
|
2022-11-25 15:52:40 +07:00
|
|
|
dest: "{{ nginx_helper_dir }}/{{ item | basename | regex_replace('.j2$', '') }}"
|
2021-09-01 16:45:44 +07:00
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2016-01-12 00:20:42 +07:00
|
|
|
with_fileglob: '../templates/etc/nginx/helper/*.j2'
|
2022-11-25 15:52:40 +07:00
|
|
|
notify: Reload nginx
|
2016-01-12 00:20:42 +07:00
|
|
|
|
|
|
|
- name: TEMPLATE | Deploy custom http configuration
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.template:
|
2017-07-27 17:21:10 +07:00
|
|
|
src: "etc/nginx/conf.d/custom.conf.j2"
|
|
|
|
dest: "{{ nginx_etc_dir }}/conf.d/custom.conf"
|
2021-09-01 16:45:44 +07:00
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2022-11-25 15:52:40 +07:00
|
|
|
notify: Reload nginx
|
2016-01-12 00:20:42 +07:00
|
|
|
|
2016-08-30 22:14:34 +07:00
|
|
|
- name: LINEINFILE | Fix path
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.lineinfile:
|
2017-07-27 17:21:10 +07:00
|
|
|
regexp: '{{ item.0.regexp }}'
|
|
|
|
line: '{{ item.0.line }}'
|
|
|
|
dest: '{{ item.1 }}'
|
2019-01-24 17:05:46 +07:00
|
|
|
loop: "{{ list_one | product(list_two) | list }}"
|
|
|
|
vars:
|
|
|
|
list_one:
|
2016-08-30 22:14:34 +07:00
|
|
|
- regexp: '^fastcgi_param SCRIPT_FILENAME'
|
|
|
|
line: 'fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;'
|
|
|
|
- regexp: '^fastcgi_param DOCUMENT_ROOT'
|
|
|
|
line: 'fastcgi_param DOCUMENT_ROOT $realpath_root;'
|
2019-01-24 17:05:46 +07:00
|
|
|
list_two:
|
2018-03-17 03:56:15 +07:00
|
|
|
- '{{ nginx_etc_dir }}/fastcgi.conf'
|
2016-08-30 22:14:34 +07:00
|
|
|
when: nginx_fastcgi_fix_realpath
|
2018-03-17 03:56:15 +07:00
|
|
|
|
|
|
|
- name: COPY | Add modules manually
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.copy:
|
2018-03-17 03:56:15 +07:00
|
|
|
content: |
|
|
|
|
{% for m in nginx_load_modules %}
|
|
|
|
load_module {{ m }};
|
|
|
|
{% endfor %}
|
|
|
|
dest: "{{ nginx_etc_dir }}/modules-enabled/000-modules.conf"
|
2021-09-01 16:45:44 +07:00
|
|
|
mode: 0644
|
|
|
|
owner: root
|
|
|
|
group: root
|
2022-11-25 15:52:40 +07:00
|
|
|
notify: Reload nginx
|