If you have so many tasks in your Ansible playbook, sometimes we need to run the specific task without whole playbook. It is possible to run only one task in an Ansible playbook with the help of "--tags" option followed by the name of the specific tag associated with the task.
Here's an example playbook with two tasks, each with a unique tag:

- name: Example playbook
  hosts: all

  tasks:
    - name: Task 1
      command: echo "Hello, world!"
      tags: task1

    - name: Task 2
      command: echo "Goodbye, world!"
      tags: task2


To run only the first task with the "task1" tag, you can use the following command:
ansible-playbook example_playbook.yml --tags "task1"

This will run only task under "task1" tag.

If you want to skip a specific task, you can use the --skip-tags option. For example, to skip the task "task1", you can use the following command:
ansible-playbook example_playbook.yml --skip-tags "task1"

This command will run all tasks in the playbook except for the tasks associated with the "task1" tag.