ansible-playbook使用示例参考
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible-playbook使用示例参考相关的知识,希望对你有一定的参考价值。
ansible-playbook参考
(1)基础示例
~]# vim base.yaml - hosts: 192.168.1.114 remote_user: root tasks: - name: install httpd server yum: name=httpd state=present - name: start httpd server service: name=httpd state=started
(2)handlers示例
~]# vim handlers.yaml - hosts: 192.168.1.114 remote_user: root task: - 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
以上是关于ansible-playbook使用示例参考的主要内容,如果未能解决你的问题,请参考以下文章