Ansible:[DEPRECATION WARNING]:不推荐使用裸变量

anu*_*uiq 11 ansible

我认为这是剧本中产生错误的部分.我该如何重写这部分内容?

roles: 
- role: json-transform
  json_transforms: '{{ clientValidation.json_transforms}}'
Run Code Online (Sandbox Code Playgroud)

它抛出以下警告:

[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.
Run Code Online (Sandbox Code Playgroud)

nit*_*one 12

看起来你的顶级水平没有任何问题 - 这可能是你角色里面的东西.不推荐的裸变量通常出现在with_xxx循环中; 例如:

- hosts: blar
  vars:
    items:
    - one
    - two
  tasks:
  - debug: msg="hi from {{ item }}"
    with_items: items
Run Code Online (Sandbox Code Playgroud)

在这种情况下,它告诉你with_items: items应该是with_items: "{{ items }}".