playbook中写循环,运行的时候有个警告

来源:2-7 使用playbook实战Python环境的安装

喵的薛定谔i

2018-12-19

[DEPRECATION WARNING]: Invoking "apt" only once while using a loop via
squash_actions is deprecated. Instead of using a loop to supply multiple items
and specifying `name: {{ item }}`, please use `name: [u'python-dev', u'python-
setuptools']` and remove the loop. This feature will be removed in version 2.11.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
  • 这个在yaml文件里面怎么改一下,可以不让他抛出这个警告呢?这样对么?
    原来的是:
apt:
  name: "{{ item }}"
  state: latest
  update_cache: yes
with_items:
  - python-dev
  - python-setuptools

改为:

apt:
  name: [u'python-dev', u'python-setuptools']
  state: latest
  update_cache: yes
写回答

1回答

七寸法师

2018-12-20

嗯,看着没问题,实际运行有问题吗?

0
1
喵的薛定谔i
没问题,只是会有这么一个警告爆出来
2018-12-20
共1条回复

中小型企业通用自动化运维架构

Jenkins+Ansible+Zabbix+Jumpserver+ELK,一套“拿来就能用”的自动化运维架构

544 学习 · 106 问题

查看课程