Process any remote configuration templates.
This commit is contained in:
parent
3d8f2f46c9
commit
84c5073620
|
@ -29,8 +29,9 @@ nginx_conf_snippets:
|
|||
- nginx-server-ssl.conf
|
||||
- nginx-cors.conf
|
||||
|
||||
nginx_old_snippets:
|
||||
- compression.conf
|
||||
nginx_conf_remote_snippets: []
|
||||
# - url: 'https://example.org/git/template.conf.j2'
|
||||
# file: file.conf
|
||||
|
||||
nginx_workers: 4
|
||||
nginx_worker_connections: 1024
|
||||
|
|
|
@ -22,6 +22,23 @@
|
|||
with_items: '{{ nginx_conf_snippets }}'
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Download any remote snippet templates
|
||||
get_url:
|
||||
url: '{{ item.url }}'
|
||||
dest: '/var/tmp/{{ item.file }}'
|
||||
loop: '{{ nginx_conf_remote_snippets }}'
|
||||
delegate_to: 'localhost'
|
||||
|
||||
- name: Install any remote snippet configuration file
|
||||
template:
|
||||
src: '/var/tmp/{{ item.file }}'
|
||||
dest: '/etc/nginx/snippets/{{ item }}'
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0444
|
||||
loop: '{{ nginx_conf_remote_snippets }}'
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Create the modules- directories
|
||||
file:
|
||||
dest: '/etc/nginx/modules-{{ item }}'
|
||||
|
@ -64,20 +81,15 @@
|
|||
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf mode=444
|
||||
notify: Reload nginx
|
||||
|
||||
- name: Remove the old configuration snippets
|
||||
file: dest=/etc/nginx/conf.d/{{ item }} state=absent
|
||||
with_items: '{{ nginx_old_snippets }}'
|
||||
notify: Reload nginx
|
||||
|
||||
when: nginx_enabled
|
||||
tags: [ 'nginx', 'nginx_conf', 'nginx_virtualhost' ]
|
||||
tags: ['nginx', 'nginx_conf', 'nginx_virtualhost']
|
||||
|
||||
- block:
|
||||
- name: remove nginx default virtualhost
|
||||
file: dest=/etc/nginx/sites-enabled/default state=absent
|
||||
notify: Reload nginx
|
||||
|
||||
|
||||
when:
|
||||
- nginx_enabled
|
||||
- ansible_distribution_file_variety == "Debian"
|
||||
tags: [ 'nginx', 'nginx_conf', 'nginx_virtualhost' ]
|
||||
tags: ['nginx', 'nginx_conf', 'nginx_virtualhost']
|
||||
|
|
Loading…
Reference in New Issue