mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 18:29:21 +00:00 
			
		
		
		
	Updated tests/integration/test_vars_usage_in_yaml.py:
- Variables immediately followed by '(' are now treated as function calls,
  not as set variables. This prevents false errors.
- Fixed detection of redirect_domain_mappings so it is no longer flagged
  as unused.
See: https://chatgpt.com/share/68c3542d-f44c-800f-a483-b3e43739f315
		
	
Nginx WWW Redirect 🌐
Description
Automates the creation of Nginx server blocks that redirect all www. subdomains to their non-www equivalents. Simple, idempotent, and SEO-friendly! 🚀
Overview
This role will:
- Discover existing *.confvhosts in your Nginx servers directory
- Filter domains with or without your PRIMARY_DOMAIN
- Generate redirect rules via the web-opt-rdr-domainsrole
- Optionally include a wildcard redirect template (experimental) ⭐️
- Clean up leftover configs when running in cleanup mode 🧹
All tasks are guarded by “run once” facts and MODE_CLEANUP flags to avoid unintended re-runs or stale files.
Purpose
Ensure that any request to www.example.com automatically and permanently redirects to https://example.com, improving user experience, SEO, and certificate management. 🎯
Features
- Auto-Discovery: Scans your Nginx serversdirectory for.conffiles. 🔍
- Dynamic Redirects: Builds source: "www.domain"→target: "domain"mappings on the fly. 🔧
- Wildcard Redirect: Includes a templated wildcard server block for www.*domains (toggleable). ✨
- Cleanup Mode: Removes the wildcard config file when CERTBOT_FLAVORis set todedicatedandMODE_CLEANUPis enabled. 🗑️
- Debug Output: Optional MODE_DEBUGgives detailed variable dumps for troubleshooting. 🐛