首页 > 其他 > 详细

ansible常用基础命令整合

时间:2018-02-28 18:02:37      阅读:262      评论:0      收藏:0      [点我收藏+]
查看组内主机列表

ansible webservers --list-hosts

执行命令

-m shell
# ansible all -m shell -a ‘hostname‘

复制文件

-m copy
# ansible all -m copy -a ‘src=/etc/hosts dest=/etc/hosts‘

用户管理

-m user

添加用户

# ansible all -m user -a "name=lala password=123"

删除用户

# ansible web1 -m user -a "name=lala state=absent"

软件包管理

-m yum

删除软件

# ansible web1 -m yum -a ‘name=httpd state=removed‘

安装软件

# ansible web1 -m yum -a ‘name=httpd state=latest‘

服务管理

-m service
# ansible webservers -m service -a ‘name=httpd state=started‘

采集主机信息

# ansible web1 -m setup -a

ansible常用基础命令整合

原文:http://blog.51cto.com/13523939/2074022

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!