Files
oam/snippets/ansible/use tasks from other files.yml
2025-07-26 10:47:40 +02:00

31 lines
1000 B
YAML

---
# <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/import_tasks_module.html>
# <https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_tasks_module.html>
- name: Use tasks from other files
hosts: localhost
connection: local
gather_facts: false
tasks:
- name: Import tasks in-line
ansible.builtin.import_tasks: tasks/debug.yml
- name: Import tasks with arguments and set variables for them
vars:
somevar: some value
ansible.builtin.import_tasks:
file: tasks/control flows.yml
- name: Include tasks in-line
tags: always
ansible.builtin.include_tasks: tasks/manipulate data.yml
- name: Include tasks with arguments and set variables for them
tags: always
vars:
somevar: some value
ansible.builtin.include_tasks:
file: tasks/manipulate data.yml
apply:
tags: data_manipulation
vars:
someothervar: some other value