]> gitweb.hamatoma.de Git - ansknife.git/commitdiff
t_nginx_remote_proxy main
authorHamatoma <author@hamatoma.de>
Wed, 5 Nov 2025 19:09:50 +0000 (20:09 +0100)
committerHamatoma <author@hamatoma.de>
Wed, 5 Nov 2025 19:09:50 +0000 (20:09 +0100)
tasks.templates/t_nginx_reverse_proxy.yaml [new file with mode: 0644]

diff --git a/tasks.templates/t_nginx_reverse_proxy.yaml b/tasks.templates/t_nginx_reverse_proxy.yaml
new file mode 100644 (file)
index 0000000..35434d1
--- /dev/null
@@ -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
+