kx-waf/generate_nginx_config.yml
2025-01-19 16:34:01 +00:00

66 lines
1.5 KiB
YAML

---
- name: Generate NGINX configuration
hosts: localhost
gather_facts: no
vars_prompt:
- name: TS_DIR
prompt: "Enter the TS-XXXXX directory name where the conf file will be placed"
private: no
- name: upstream_name
prompt: "Enter the upstream name"
private: no
- name: zone
prompt: "Enter the zone name"
private: no
- name: backend1
prompt: "Enter the IP address of backend1"
private: no
- name: backend1_port
prompt: "Enter the port of backend1"
private: no
- name: backend2
prompt: "Enter the IP address of backend2"
private: no
- name: backend2_port
prompt: "Enter the port of backend2"
private: no
- name: URL
prompt: "Enter the server URL"
private: no
- name: SIEM_IP
prompt: "Enter the SIEM IP address"
private: no
- name: status_zone
prompt: "Enter the status zone name"
private: no
- name: saml_yes
prompt: "Is SAML required (yes/no)?"
private: no
tasks:
- name: Ensure TS-XXXXX directory exists in the current directory
file:
path: "./{{ TS_DIR }}"
state: directory
- name: Set SAML variable
set_fact:
saml_prefix: "{% if saml_yes == 'yes' %}s{% else %}{% endif %}"
- name: Generate the NGINX configuration file
template:
src: nginx_template.j2
dest: "./{{ TS_DIR }}/{{ URL }}.conf"
vars:
saml_yes: "{{ saml_prefix }}"