ansible安装

ansible安装

一、安装步骤

1、实验准备

管理端: 192. 168. 150.136
被管理端: 192. 168. 150.137
被管理端: 192. 168. 150.138

2、安装工具包

yum install -y epel- release //安装epel 源

yum install ansible -y

ansible --version //查看ansible版本

yum install tree -y

3、查看配置文件结构

tree /etc/ansible/ //树状结构 展示文件夹

ansible. cfg #ansible的配置文件
hosts #ansible的主仓库,用于存储需要管理的远程
roles #角色文件

cd /etc/ansible

vi hosts

//配置主机清单
[webserver]
192.168.150.137
[mysql]
192.168.150.138

4、创建密钥并复制给被管理者

ssh-keygen -t rsa

ssh-copy-id root@192.168.150.157

ssh-copy-id root@192.168.150.158

5、免交互代理

ssh-agent bash

ssh-add

6、查询使用

ansible webserver -m command -a ‘date’

ansible 192.168.150.157 -m command -a ‘date’

ansible mysql -m command -a ‘date’

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值