在ansible

时间:2017-04-14 16:57:51

标签: ansible ansible-2.x

我的数据文件看起来像

---
data:
  - item 1
  - item 2
  - item 3
  - item 4

我想要包含项目1的任务手册和项目2 - 4的不同任务手册。如何创建仅包含['项目2','项目3' ,'项目4']

---
- hosts: localhost
tasks:
  - include: taskbooks1.yml param={{data[0]}}

  - include: taskbooks2.yml param={{item}}
    with_indexed_items: "{{ data }}" # I want to pass another list without item 1

1 个答案:

答案 0 :(得分:1)

- include: taskbooks2.yml param={{item}}
  with_items: "{{data[1:]}}"