Ansible 安装和管理服务

ansible 使用 yum 模块来安装软件包,使用 service 模块来启动软件:

[root@localhost ~]$ ansible 192.168.119.134 -m yum -a "name=httpd"                                  # 安装软件包
[root@localhost ~]$ ansible 192.168.119.134 -m yum -a "name=httpd state=removed"                    # 卸载软件包
[root@localhost ~]$ ansible 192.168.119.134 -m service -a "name=httpd state=started enabled=yes"    # 启动并设置成开机启动

 

 

 

 

    

posted @ 2019-01-03 12:27  孔雀东南飞  阅读(305)  评论(0编辑  收藏  举报