Write Ansible Playbook using tags - (skip a specific task by using tag)

playbook name: task2.yaml
---
- name: install packages
  hosts: all
  become: yes
  tasks:
    - name: install httpd
      yum: 
          name: httpd 
          state: absent
          tags: httpd
    - name: install docker
      yum: 
          name: docker 
          state: absent
          tags: docker
    - name: install java
       yum: 
           name: java 
           state: present
           tags: java

    
we have 3 tasks
1) Install httpd
2) Install docker
3) Install java

but I would like to execute skip java execution task by using tag name
step1: create playbook:
       ex: playbook name: task2.yaml
step2: execution process:
       ansible-playbook task1.yaml --skip-tags java
step3: result:
       only java software install execution task will be skipped
       and remaining tasks will be executed on target machines


vist our YouTube Channel: https://www.youtube.com/@VansroTechnologies/videos

Comments

Popular posts from this blog

Top 10 Git Commands

Kubernetes cluster setup NOTES step by step using minikube

SonarQube Installation & Configuration Step by step