很多情况下,我们需要去重启相应的服务,当修改配制文件的时候,例如:
apache,我们需要重启apache,如果apache的配置文件发生边的话,这个时候我们就需要notify
notify 是来触发一个handle
1 2 3 4 5 |
- name: template configuration file template: src=template.j2 dest=/etc/foo.conf notify: - restart memcached - restart apache |
而其中的 restart apache 其实是一个handlers,主要的作用就是重启apache,如下
1 2 3 4 5 |
handlers: - name: restart memcached service: name=memcached state=restarted - name: restart apache service: name=httpd state=restarted |
此处注意是httpd,不是apache
Latest posts by Zhiming Zhang (see all)
- istio Ingress Gateways - 十一月 25, 2020
- Istio VirtualService - 十一月 23, 2020
- istio 组件 - 十一月 18, 2020