How to get environment variables of remote host

后端 未结 2 1248
北荒
北荒 2021-01-17 12:44

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

2条回答
  •  [愿得一人]
    2021-01-17 12:57

    According to the documentation here, you can't use lookup for remote machines, that keyword only works for the local machine.

    Instead, you want to use {{ ansible_env.PATH}}.

提交回复
热议问题