小编Pet*_*eks的帖子

ansible 查找不适用于环境变量

Ansible 查找不适用于环境变量。

这有效:

- name: WIN_SHELL | Get ComputerName
  win_shell: $Env:ComputerName
  register: computerName

- debug:
    var: computerName.stdout_lines.0
Run Code Online (Sandbox Code Playgroud)

这些都没有:

- debug:
    msg: '{{lookup("env", "ComputerName")}}'

- debug:
    msg: '{{ lookup("env", "COMPUTERNAME") }}'

- debug:
    msg: '{{ lookup("env", "computername") }}'

- debug:
    msg: '{{ lookup("env", "computerName") }}'
Run Code Online (Sandbox Code Playgroud)

关于 ansible 查找有什么我不明白的地方吗?或者是否有一些情有可原的情况阻止了这一点?我宁愿使用 ansible 查找而不是 win_shell 来保持幂等性。

lookup environment-variables ansible

1
推荐指数
1
解决办法
4666
查看次数

标签 统计

ansible ×1

environment-variables ×1

lookup ×1