远程执行命令
2016-05-06 16:27
183 查看
1、修改配置文件
# vim /etc/ansible/hosts
[testhosts]
127.0.0.1
192.168.32.105
2.执行 command 模块
ansible testhosts -m command -a 'w'
ansible 127.0.0.1 -m command -a 'hostname'
3、报错缺少 libselinux-python
yum -y install libselinux-python
4、用 shell 来执行
ansible slave-puppet.zjcap.cn -m shell -a 'hostname'
ansible slave-puppet.zjcap.cn -m shell -a 'cat /etc/passwd| grep root' 支持管道
# vim /etc/ansible/hosts
[testhosts]
127.0.0.1
192.168.32.105
2.执行 command 模块
ansible testhosts -m command -a 'w'
ansible 127.0.0.1 -m command -a 'hostname'
3、报错缺少 libselinux-python
yum -y install libselinux-python
4、用 shell 来执行
ansible slave-puppet.zjcap.cn -m shell -a 'hostname'
ansible slave-puppet.zjcap.cn -m shell -a 'cat /etc/passwd| grep root' 支持管道
相关文章推荐
- 各种功能
- docker安装
- C++中的构造函数学习
- 使用Cocoapods创建私有podspec
- PHP检测链接是否存在的代码实例分享
- easy-ui之datagrid 单元格样式设置
- 第一个爬虫:爬糗事百科笑话
- Android线性布局(Linear Layout)
- 通过position获取listview中viewHolder的方式
- RabbitMq、ActiveMq、ZeroMq、kafka之间的比较,资料汇总
- c++ unique函数返回值
- OpenWrt自动挂载sd卡
- RMAN备份动态性能视图 V$BACKUP_SET
- random
- Spring面试,IoC和AOP的理解
- 聚集索引和非聚集索引的区别
- ps在psd格式图片里面切图流程
- addslashes_stripslashes.php
- 强对流天气造成我省局部受灾
- poj-2112-Optimal Milking(最大流)