【发布时间】:2016-04-26 17:13:39
【问题描述】:
我认为这是剧本中产生错误的部分。我应该如何重写这部分?
roles:
- role: json-transform
json_transforms: '{{ clientValidation.json_transforms}}'
它会引发以下警告:
[DEPRECATION WARNING]: Using bare variables is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{json_transforms}}'). This feature will be removed in a
future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
【问题讨论】:
-
您使用的是什么 Ansible 版本?这种语法对我来说有点奇怪,通常我会使用类似:
- { role: json-transform, json_transforms: '{{ clientValidation.json_transforms}}' }所以你可能想尝试一下。 -
我正在使用 Ansible 2.0.1 我已经尝试过你提到的但它没有工作。
-
语法无关紧要-@ydaetskcoR 只是使用内联dict 语法而不是扩展的yaml dict 语法。它们在解析后的文档中完全相同。
-
似乎这个问题在某种程度上与这里的这个主题有关 [1]。当您尝试对裸变量使用 then “when” 方法进行验证时,通常会发生这种情况。从 ansible 2.8 及更高版本开始,您应该使用
when: myVariable|bool之类的东西以符合最新标准 [1] github.com/geerlingguy/ansible-role-ntp/issues/59
标签: ansible