赞
踩
[root@m0 ansible]# ansible group02 -m ping
[root@m0 ~]# vim test0001.yml --- - hosts: group02 remote_user: root tasks: - name: 卸载vsftpd yum: name=vsftpd state=absent - name: 安装vsftpd yum: name=vsftpd state=latest - name: 启动服务 service: name=vsftpd state=started enabled=yes ~
[root@m0 ~]# ansible-playbook ./test0001.yml
[root@m0 ~]# vim test0001.yml --- - hosts: group02 remote_user: root tasks: - name: 卸载vsftpd yum: name=vsftpd state=absent - name: 安装vsftpd yum: name=vsftpd state=latest - name: 启动服务 service: name=vsftpd state=started enabled=yes - name: 修改配置文件 copy: src=/etc/vsftpd/vsftpd.conf dest=/etc/vsftpd/vsftpd.conf notify: - abcd handlers: - name: abcd service: name=vsftpd state=restarted ~ ~
[root@m0 ~]# ansible-playbook ./test0001.yml
[root@m0 ~]# vim httpd001.yml --- - hosts: group02 remote_user: root task: - name: 安装httpd yum: name=httpd state=latest - name: 修改配置文件 command: sed -i '/^Listen/s/80/8080/g' /etc/httpd/conf/httpd.conf - name: 修改默认资源文件 command: echo 'http html file' > /var/www/html/index.html - name: 启动httpd服务 service: name=httpd state=started ~ ~
[root@m0 ~]# ansible-playbook ./httpd001.yml
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。