[英]Using include_vars in Ansible task
我有一個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
基於以下文章: 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
現在,該任務運行,沒有任何警告。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.