Not a DevOps eng so this might not be the most elegant answer but you could write an Ansible playbook to edit a hosts file on the target server and trigger that after deployment, within your CI/CD pipeline.
In an ideal situation, though, all your servers connect to a centralised DNS server (usually your gateway) where those domain names are managed.