我扮演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_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 version = 2.7.15 (v2.7.15:ca079a3ea3, Apr 29 2018, 20:59:26) [GCC
4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
参考:https://docs.ansible.com/ansible/2.7/modules/include_vars_module.html
答案 0 :(得分:0)
基于以下文章: https://github.com/ansible/ansible/issues/12282
我尝试注释掉整个任务,并且警告消息继续显示。
然后我在随后的任务中删除标签tag: check_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
任务现在运行而没有任何警告。