在日常的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)
- 什么是ami - 二月 22, 2021
- istio Ingress Gateways - 十一月 25, 2020
- Istio VirtualService - 十一月 23, 2020