ansible]# vim adhttp.yml
---
- hosts: cache
remote_user: root
tasks:
- copy:
src: /root/httpd.conf
dest: /etc/httpd/conf/httpd.conf
owner: root
group: root
mode: 0644
tags: config_httpd
notify:
- restart httpd
handlers:
- name: restart httpd
service: name=httpd state=restarted
2)调用方式
ansible]# ansible-playbook adhttp.yml --tags=config_httpd
YAML_14 tags给指定的任务定义一个调用标识,以后不用重复整个过程,只需要执行tags标签的部分
原文:https://www.cnblogs.com/luwei0915/p/10615722.html