ansible安装
【摘要】 ansible安装前言本文介绍如何在centos 7上安装 ansible安装安装准备# 文档中脚本默认均以root用户执行# 安装 epel 源yum install epel-release -y# 安装依赖工具yum install git python python-pip -yansible安装,更改国内镜像# 安装ansible (国内如果安装太慢可以直接用pip阿里云加速)#p...
ansible安装
前言
本文介绍如何在centos 7上安装 ansible
安装
安装准备
# 文档中脚本默认均以root用户执行
# 安装 epel 源
yum install epel-release -y
# 安装依赖工具
yum install git python python-pip -y
ansible安装,更改国内镜像
# 安装ansible (国内如果安装太慢可以直接用pip阿里云加速)
#pip install pip --upgrade
#pip install ansible
pip install pip --upgrade -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
pip install --no-cache-dir ansible -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# 配置ansible ssh密钥登陆
ssh-keygen -t rsa -b 2048 回车 回车 回车
ssh-copy-id root@$IP
#$IP为需要控制机器的ip地址,按照提示输入yes 和root密码 更多ssh key设置见github文章
验证
设置需控制的机器
sudo vim /etc/ansible/hosts
192.168.1.196 ansible_ssh_user=root
测试是否联通
fangleMac:~ fangle$ ansible all -m ping
SSH password:
192.168.1.196 | SUCCESS => {
"changed": false,
"ping": "pong"
}
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)