How can I set an Ansible variable depending on hostname?

Solution 1:

For anyone else running across this, I ended up putting symlinks in my playbooks directory. I didn't realize when setting up ansible that putting playbooks in a different directory would cause these issues. I sure don't want hundreds of playbooks cluttering the ansible root however so this works. I could do the same with group_vars as it's in my playbooks as vars_files: ../group_vars/ but for now that seems OK.

ansible
├── ansible.cfg
├── group_vars
├── host_vars
│   └── my.host.net.yml
├── inventories
├── templates
├── playbooks
│   ├── snapshot.yml
│   ├── templates -> ../templates 
|   └── host_vars -> ../host_vars
├── roles
└── tests