---

# <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
