From: Hamatoma Date: Wed, 5 Nov 2025 19:09:50 +0000 (+0100) Subject: t_nginx_remote_proxy X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=d3f58c72f055c956d75498337bd5d538010e0025;p=ansknife.git t_nginx_remote_proxy --- diff --git a/tasks.templates/t_nginx_reverse_proxy.yaml b/tasks.templates/t_nginx_reverse_proxy.yaml new file mode 100644 index 0000000..35434d1 --- /dev/null +++ b/tasks.templates/t_nginx_reverse_proxy.yaml @@ -0,0 +1,34 @@ +--- +# # Creates the nginx site configuration file for a reverse proxy +# needed facts (variables): +# domain: the site domain name +# port: the port of the application +# nickname: a short name of the web site (used in log file names) +- name: test pre-requisites + fail: msg="missing fact! domain... Use -e domain=..." + when: domain is not defined or port is not defined or nickname is not defined +- name: Create the configuration file + ansible.builtin.template: ../templates.fix/nginx/reverse_proxy.j2 + src: "../template.fix/nginx/reverse_proxy.j2" + dest: "/etc/nginx/sites-available/{{ domain }}" + vars: + domain="{{ domain}}" + nickname="{{ nickname }}" + port="{{ port }}" + - name: Build the symbolic links + ansible.builtin.file: + src: "../sites-available/{{ domain }}" + dest: "/etc/nginx/sites-enabled/{{ domain }}" + state: link + force: true + follow: false + with_list: "{{ webapps_list }}" + notify: + - reload nginx +handlers: + - name: reload nginx + service: + name: nginx + state: reloaded + enabled: true +