tags 可以给tasks打标签,之后按照标签有选择的执行任务
- hosts: 127.0.0.1
tasks:
- name: mkdir
tags:
- mkdir1
file:
path: /tmp/testdir/1
state: directory
recurse: yes
owner: test
- name: touch
tags:
- touch1
file:
path: /tmp/testdir/1/1.txt
state: touch
owner: test
mode: 0600
ansible-playbook --list-tags play.yml
ansible-playbook --tags=mkdir1 play.yml
ansible-playbook --skip-tags=mkdir1 play.yml
ansible-playbook --skip-tags mkdir1,touch1 play.yml
标签:play,palybook,tags,mkdir1,ansible,playbook,yml
From: https://www.cnblogs.com/wangend/p/17059150.html