Acfe 发表于 2018-7-30 07:54:05

ansible-playbook使用示例参考

~]# vim handlers.yaml  
- hosts: 192.168.1.114
  
remote_user: root
  
tasks:
  
- name: install httpd
  
yum: name=httpd state=present
  
- name: install configure file
  
copy: src=file/httpd.conf dest=/etc/httpd/conf/httpd.conf
  
notify: restart httpd server
  
handlers:
  
- name: restart httpd server
  
service: name=httpd state=restarted
  
~]# vim file/httpd.conf
  
修改Listen 80为Linsten 8080
  
~]# ansible-playbook --check handlers.yaml
页: [1]
查看完整版本: ansible-playbook使用示例参考