Using an ansible playbook with tag and parameter

main.yml

main.yml


---
- hosts: all
  tasks:
    - include: includeFile.yml tags=t1

    - debug: msg="Inside main file"
      tags:
        - t2

includeFile.yml


- debug: msg="task 1 in includeFile"
  tags:
    - t1

- debug: msg="task 2 in includeFile"
  tags:
    - t2

- debug: msg="task 3 in includeFile"
  tags:
    - t3

How to run it?


$ ansible-playbook -i hosts main.yml --tags "t1"