在日常的ansible-playbook中使用tags 来灵活控制我们向要执行的具体的task , 有时候能达到意想不到的效果
看例子:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
--- - hosts: all tasks: - name: My tagged task yum: name: httpd state: latest tags: production - name: Installs postfix yum: name: postfix state: latest |
只执行第一个task:
1 |
ansible-playbook main.yml --tags 'production' |
只执行第二个task:
1 |
ansible-playbook main.yml --skip-tags 'production' |
Latest posts by Zhiming Zhang (see all)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021