包含play
---
- hosts: localhost
tasks:
- debug:
msg: play1
- name: Include a play after another play
include: otherplays.yaml
包含task列表
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play
include: stuff.yaml
- debug:
msg: task10
如果條件滿足,則包含task列表
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play only if the condition is true
include: "{{ hostvar }}.yaml"
static: no
when: hostvar is defined