Removed bugs and implemented new server config structure

This commit is contained in:
2023-12-12 12:32:35 +01:00
parent cac9e6e1c8
commit b1e71e3875
25 changed files with 66 additions and 39 deletions

View File

@@ -1,15 +1,15 @@
---
- name: Find all .conf
ansible.builtin.find:
paths: "/etc/nginx/conf.d/"
paths: "{{nginx_servers_directory}}"
patterns: '*.*.conf'
register: conf_files
- name: Filter domain names and remove .conf extension and path
set_fact:
filtered_domains: "{{ conf_files.files | map(attribute='path') | map('regex_search', domain_regex) | select('string') | map('regex_replace', '^/etc/nginx/conf.d/', '') | map('regex_replace', '.conf$', '') | list }}"
filtered_domains: "{{ conf_files.files | map(attribute='path') | map('regex_search', domain_regex) | select('string') | map('regex_replace', '^{{nginx_servers_directory}}', '') | map('regex_replace', '.conf$', '') | list }}"
vars:
domain_regex: '^/etc/nginx/conf.d/(?!www\.)[^/]+\.conf$'
domain_regex: '^{{nginx_servers_directory}}(?!www\.)[^/]+\.conf$'
- name: The domains for which a www. redirect will be implemented
debug: