Ansible 1.6包含with_items已弃用

jms*_*rra 17 deprecated ansible ansible-playbook

所以看起来这个功能已经被弃用了,我真的不明白为什么,Ansible CTO说我们应该使用with_nested但老实说我不知道​​怎么做,

这是我的playboook:

- hosts: all
  user: root
  vars: 
   - sites:
     - site: site1.com
       repo: ssh://hg@bitbucket.org/orgname/reponame
       nginx_ssl: true;
       copy_init:
        - path1/file1.txt
        - path2/file2.php
        - path2/file3.php

     - site: site2.net
       repo: ssh://hg@bitbucket.org/orgname/reposite2

     - site: site4.com
       repo: ssh://hg@bitbucket.org/orgname/reposite3
       copy_init:
        - path2/file2.php

  tasks:
     - name: Bootstrap Sites
      include: bootstrap_site.yml site={{item}}
Run Code Online (Sandbox Code Playgroud)

并尝试在Ansible 1.6.6中执行此错误消息:

错误:[DEPRECATED]:include + with_items是已删除的已弃用功能.请更新你的剧本.

如何将此剧本转换为适用于此ansible版本的内容?

hka*_*iti 21

不幸的是,没有直接替代品.你可以做的一些事情:

更新: Ansible V2出来并带回include + with_items 组合循环!