侧边栏壁纸
  • 累计撰写 221 篇文章
  • 累计创建 205 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

ansible 管理服务

zhanjie.me
2018-08-05 / 0 评论 / 0 点赞 / 0 阅读 / 0 字

ansible 管理服务

 模块 yum

  安装一个包

[root@server ~]# ansible client.test.com -m yum -a "name=httpd"

 在name后面还可以加上state=installed,不加也能安装

  管理服务 service 模块

[root@server ~]# ansible client.test.com -m service -a "name=httpd state=started enabled=no"    //启动服务,不开机启动

client.test.com | SUCCESS => {

    "changed": true,

    "enabled": false,

    "name": "httpd",

    "state": "started"

}


[root@server ~]# ansible client.test.com -m service -a "name=httpd state=stopped enabled=yes"

client.test.com | SUCCESS => {

    "changed": true,

    "enabled": true,

    "name": "httpd",

    "state": "stopped"

}

 ansible文档的使用

 列出所有模块

[root@server ~]# ansible-doc -l

 列出指定模块

[root@server ~]# ansible-doc service
0

评论区