tags可以对任务打标签,在执行playbook时,借助标签,指定执行哪些tags的任务,或者指定不执行哪些tags任务了
基本操作
---
- hosts: web
remote_user: root
tasks:
- name: task1
file:
path: /data/t1
state: touch
tags: t1
- name: task2
file: path=/data/t2 state=touch
tags: t2
- name: task3
file: path=/data/t3 state=touch
tags: t3
# ansible-playbook --tags=t2 文件名 执行剧本
标签:进阶,tags,state,ansible,file,touch,path
From: https://www.cnblogs.com/FGdeHB/p/16811678.html