在Ansible任务中使用include_变量

在Ansible任务中使用include_变量,ansible,ansible-2.x,Ansible,Ansible 2.x,我有一个Ansible角色,我在main.yml任务中使用了include_vars。 该任务正在工作,但在详细模式下运行时,我注意到以下警告 [DEPRECATION WARNING]: Specifying include variables at the top-level of the task is deprecated. Please see: https://docs.ansible.com/ansible/playbooks_roles.html#task- include-

我有一个Ansible角色,我在main.yml任务中使用了
include_vars
。 该任务正在工作,但在详细模式下运行时,我注意到以下警告

[DEPRECATION WARNING]: Specifying include variables at the top-level of 
the task is
deprecated. Please see: 
https://docs.ansible.com/ansible/playbooks_roles.html#task-
include-files-and-encouraging-reuse   for currently supported syntax 
regarding included
files and variables. This feature will be removed in version 2.12. 
Deprecation
warnings can be disabled by setting deprecation_warnings=False in 
ansible.cfg.
文件:role\u name/tasks/main.yml

 - name: Reference variable files
   include_vars: "{{ item }}"
   with_first_found:
     - "{{ ansible_distribution|lower }}.yml"
     - "{{ ansible_virtualization_type }}.yml"
     - default.yml
警告消息中提供的URL未提供明确的解决方案

引用这些变量文件的正确位置在哪里

谢谢

ansible 2.7.2
python版本=2.7.15(v2.7.15:ca079a3ea3,2018年4月29日,20:59:26)[GCC]
4.2.1兼容苹果LLVM 6.0(clang-600.0.57)]


参考资料:

基于以下文章:

我试着对整个任务进行注释,警告消息继续显示

然后,我删除标签
标签:在接下来的任务中选中_vg

- name: Reference variable files
   include_vars: "{{ item }}"
   with_first_found:
     - "{{ ansible_distribution|lower }}.yml"
     - "{{ ansible_virtualization_type }}.yml"
     - default.yml

 - name: Run App Volume Group Configuration Task
   include: app_vg_config.yml
   when: configure_app_vg == true
   tag: check_vg  # <- This seems to cause an issue
-名称:参考变量文件
包括变量:“{{item}”
在第一个找到的情况下:
-“{ansible_分布| lower}}.yml”
-“{{ansible\u virtualization\u type}}.yml”
-default.yml
-名称:运行应用程序卷组配置任务
包括:app_vg_config.yml
时间:configure_app_vg==true

标记:检查_vg#这在
CentOS Linux 7.5.1804版
@JGK上的
ansible 2.7.2
中不可复制,谢谢检查。我在“标记”中漏掉了“s”。这是完全不相关警告的实际原因!