i have a series of playbooks that use ansible_hostname to determine whether tasks should run. on a host these work fine as one would expect, but when running ansible inside a chroot environment with /proc,sys,dev mounted. ansible pulls the hostname from the host outside of the chroot into ansible_hostname,ansible_fqdn,ansible_nodename variables
is there a reliable way to tell ansible, this is what the hostname name regardless outside factors?
i tried settings facts to override the three variables or tricking it through the inventory, but ‘ansible -m setup localhost’ inside the chroot always seems to grab the hostname from outside the chroot
i’m likely doing something wrong, but i’m not sure what
thanks