很多情况下,我们需要去重启相应的服务,当修改配制文件的时候,例如:
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)
- aws eks node 自动化扩展工具 Karpenter - 8月 10, 2022
- ReplicationController and ReplicaSet in Kubernetes - 12月 20, 2021
- public key fingerprint - 5月 27, 2021