✅ Problem Fixed! Hostname Timing Issue Resolved
What Was Wrong:
- Hostname change happened in final_cleanup.yml (middle of system role)
- cloudflare_tunnel and selfie_app roles ran AFTER system role
- They expected the new hostname but system still had old hostname
- This caused the “hostname transition problem” documented in CLAUDE.md
Solution Implemented:
- Moved hostname changes to post_tasks in run.yml
New execution order:
- system role (no hostname change)
- cloudflare_tunnel role
- selfie_app role
- post_tasks: Set final hostname ← NOW HAPPENS LAST
Benefits:
- cloudflare_tunnel and selfie_app configure with {{ hostname }} variable
- Actual hostname change happens AFTER all roles complete
- Clean transition from ansibledest.local → thepub.localNo orphaning – roles get configured properly before hostname switches
- Resume Point: You can now resume as with –tags final_hostname_change to run just the hostname changes, or continue normally knowing the execution order is correct.
The hostname transition issue that’s been causing problems is now properly sequenced!
Key lessons:
Key Takeaways:
The Run.yml file is the ultimate arbiter of execution.
- It calls the “system” role, the “cloudflare” tunnel role and the “seflie app” role. it then has “post_tasks” that handle the brittle commands that change the state of the device.
- The system roll has all of the individual tasks in /roles/system/tasks whose order is controlled by main.yml in there.
