在ansible中如何禁用单个任务的弃用警告?
In ansible how to disable Deprecation warnings for single task?
我的一项任务在 ansible 2.8 中打印此警告
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
有没有办法仅针对一项任务禁用警告,因为我不想通过ansible.cfg
.
全局禁用
顺便说一句,任务看起来像这样......
- name: Run platform specific tasks
include_tasks: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
#
# The following ansible 2.8 warning is misleading and fixed later
# See https://github.com/ansible/ansible/pull/60161
#
# [DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12.
skip: true
是的,例如:
- shell: echo something
args:
warn: false
我发现没有办法避免这个特殊的 DEPRECATION WARNING 所以只是记录了为什么它在那里,为了记录引用:https://github.com/ansible/ansible/pull/60161
Un-deprecate skip, as the alternative of errors does not work with with_first_found and only use of lookup
换句话说,这是ansible中的一个错误,修复合并到ansible:devel
。
希望很快会有包含这个的版本,在那之前我会忍受这种噪音。
回答我自己的问题以防这对其他人有帮助。
我的一项任务在 ansible 2.8 中打印此警告
[DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
有没有办法仅针对一项任务禁用警告,因为我不想通过ansible.cfg
.
顺便说一句,任务看起来像这样......
- name: Run platform specific tasks
include_tasks: "{{ item }}"
with_first_found:
- files:
- "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
#
# The following ansible 2.8 warning is misleading and fixed later
# See https://github.com/ansible/ansible/pull/60161
#
# [DEPRECATION WARNING]: Use errors="ignore" instead of skip. This feature will be removed in version 2.12.
skip: true
是的,例如:
- shell: echo something
args:
warn: false
我发现没有办法避免这个特殊的 DEPRECATION WARNING 所以只是记录了为什么它在那里,为了记录引用:https://github.com/ansible/ansible/pull/60161
Un-deprecate skip, as the alternative of errors does not work with with_first_found and only use of lookup
换句话说,这是ansible中的一个错误,修复合并到ansible:devel
。
希望很快会有包含这个的版本,在那之前我会忍受这种噪音。
回答我自己的问题以防这对其他人有帮助。