ansible
注意,用notify的必须要注意只有当tags发生改变的时候才可以,触发条件,而且notify的名字一个匹配一个命令,不能只写一个,然后handlers多条命令,正确写法如下
--- - hosts: web1 remote_user: root tasks: - name: install the latest version of Apache yum: name: httpd state: latest - replace: path: /etc/httpd/conf/httpd.conf regexp: ‘(^Listen).*‘ replace: ‘\1 8080‘ backup: yes - replace: path: /etc/httpd/conf/httpd.conf regexp: ‘(^#ServerName ).*‘ replace: ‘\1 localhost‘ backup: yes - copy: src: test1.yml #src: /root/index.html dest: /root/user13.yml #dest: /var/www/html owner: apache group: apache mode: 0644
原文:https://www.cnblogs.com/lsgo/p/10422263.html