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
notify:
- restart httpd
handlers:
- name: restart httpd
service: name=httpd state=restarted
ansible]# ansible-playbook adhttp.yml
ansible]# ssh cache apachectl -t
Syntax OK
ansible]# curl 192.168.1.56:8080
hello world