From cf365e645d91fc2b27a322a7dc03f9e6dbe4422d Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Sun, 26 Mar 2017 12:27:47 +0200 Subject: [PATCH] draft for the reverse proxy role This role split the reverse proxy configuration in three files per host. Every file belong to a different directory that is created on the reverse proxy we use (nginx). --- roles/reverse_proxy/tasks/main.yaml | 39 ++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/roles/reverse_proxy/tasks/main.yaml b/roles/reverse_proxy/tasks/main.yaml index 0fdb755..ebe9d85 100644 --- a/roles/reverse_proxy/tasks/main.yaml +++ b/roles/reverse_proxy/tasks/main.yaml @@ -1,9 +1,36 @@ --- -# possibili nome macchina -# ansible_nodename -# ansible_hostname -- name: Upload reverse proxy configuration +- name: Create the http.conf directory for nginx + file: + state: directory + dest: "/etc/nginx/http.conf.d" + delegate_to: gandalf2 + +- name: Upload http to reverse proxy + template: + src: http.j2 + dest: "/etc/nginx/http.conf.d/http_{{ hostname }}.conf" + delegate_to: gandalf2 + +- name: Create the map.conf directory for nginx + file: + state: directory + dest: "/etc/nginx/map.conf.d" + delegate_to: gandalf2 + +- name: Create the upstream.conf directory for nginx + file: + state: directory + dest: "/etc/nginx/upstream.conf.d" + delegate_to: gandalf2 + +- name: Upload mappings to reverse proxy template: - src: reverse_proxy.j2 - dest: "/etc/nginx/nginx.conf.d/{{ nome_macchina }}.conf" + src: map.j2 + dest: "/etc/nginx/map.conf.d/map_{{ hostname }}.conf" + delegate_to: gandalf2 +- name: Upload upstream to reverse proxy + template: + src: upstream.j2 + dest: "/etc/nginx/upstream.conf.d/upstream_{{ hostname }}.conf" + delegate_to: gandalf2