ansible-nginx/tasks/config.yml

46 lines
1.3 KiB
YAML
Raw Normal View History

2016-01-12 00:20:42 +07:00
---
- name: TEMPLATE | Deploy nginx.conf
2017-07-27 17:21:10 +07:00
template:
src: "etc/nginx/nginx.conf.j2"
dest: "{{ nginx_etc_dir }}/nginx.conf"
2016-01-12 00:20:42 +07:00
notify: reload nginx
- name: TEMPLATE | Deploy all helpers
2017-07-27 17:21:10 +07:00
template:
src: "{{ item }}"
dest: "{{ nginx_helper_dir }}/{{ item | basename | regex_replace('.j2$','') }}"
2016-01-12 00:20:42 +07:00
with_fileglob: '../templates/etc/nginx/helper/*.j2'
notify: reload nginx
- name: TEMPLATE | Deploy custom http configuration
2017-07-27 17:21:10 +07:00
template:
src: "etc/nginx/conf.d/custom.conf.j2"
dest: "{{ nginx_etc_dir }}/conf.d/custom.conf"
2016-01-12 00:20:42 +07:00
notify: reload nginx
- name: LINEINFILE | Fix path
2017-07-27 17:21:10 +07:00
lineinfile:
regexp: '{{ item.0.regexp }}'
line: '{{ item.0.line }}'
dest: '{{ item.1 }}'
loop: "{{ list_one | product(list_two) | list }}"
vars:
list_one:
- 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;'
list_two:
2018-03-17 03:56:15 +07:00
- '{{ nginx_etc_dir }}/fastcgi.conf'
when: nginx_fastcgi_fix_realpath
2018-03-17 03:56:15 +07:00
- name: COPY | Add modules manually
copy:
content: |
{% for m in nginx_load_modules %}
load_module {{ m }};
{% endfor %}
dest: "{{ nginx_etc_dir }}/modules-enabled/000-modules.conf"
notify: reload nginx