I am having problems working with the environment variables of a remote host. For example, when I try {{ lookup(\'env\', \'PATH\') }} this returns the path of my guest machi
According to the documentation here, you can't use lookup for remote machines, that keyword only works for the local machine.
lookup
Instead, you want to use {{ ansible_env.PATH}}.
{{ ansible_env.PATH}}