加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

LINUX学习:RHEL 6.6下安装Ansible

发布时间:2020-12-13 17:43:57 所属栏目:Linux 来源:网络整理
导读:《LINUX学习:RHEL 6.6下安装Ansible》要点: 本文介绍了LINUX学习:RHEL 6.6下安装Ansible,希望对您有用。如果有疑问,可以联系我们。 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的长处,

《LINUX学习:RHEL 6.6下安装Ansible》要点:
本文介绍了LINUX学习:RHEL 6.6下安装Ansible,希望对您有用。如果有疑问,可以联系我们。

ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet、cfengine、chef、func、fabric)的长处,实现了批量系统配置、批量程序部署、批量运行命令等功能.(百度百科),2015年RedHat收购ansible.

主机情况:

OS:Red Hat Enterprise Linux Server release 6.6 (Santiago) x86_64
IP:172.16.10.180
Python 2.6.6
注:操作体系最小化安装

节点:

OS:Oracle Linux Server release 5.8
IP:172.16.10.10、172.16.10.200
Python 2.4.3

1、安装开发对象:

# yum -y groupinstall "Development tools"

2、安装six、yaml

# rpm -ivh python-six-1.9.0-1.el6.pp.noarch.rpm?
# rpm -ivh python-yaml-3.09-3.el6.rf.x86_64.rpm

3、安装ansible

# yum install ansible
注:受控节点必要安装python-simplejson

4、天生秘钥文件

# ./sshUserSetup.sh -user root -hosts "172.16.10.10 172.16.10.200"
输入yes和两台主机的root暗码即可完成172.16.10.180->172.16.10.10、172.16.10.180->172.16.10.200的验证
?
或者:
# ssh-keygen -t rsa -P ''
在/root/.ssh/下生成文件id_rsa.pub,拷贝到所有受控机并执行以下操作:
# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
# chmod 600 /root/.ssh/authorized_keys

5、改动hosts文件

# cd /etc/ansible/
# cat /etc/ansible/hosts
...
[dbservers]
172.16.10.10
172.16.10.200

6、改动ansible.cfg文件

# cat /etc/ansible/ansible.cfg
...
remote_port = 36000
...
private_key_file = /root/.ssh/id_rsa

7、测试

# ansible all? -m ping
# all指所有定的主机
172.16.10.10 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
172.16.10.200 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
?
# ansible dbservers -m ping? ? ?
172.16.10.200 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}
172.16.10.10 | SUCCESS => {
? ? "changed": false,?
? ? "ping": "pong"
}

8、常见差错:

A、"msg": "Error: ansible requires the stdlib json or simplejson module,neither was found!"
受控端必要安装python-simplejson
?
B、FAILED => module command not found in configured module paths. Additionally,core modules are missing. If this is a checkout,run 'git submodule update --init --recursive' to correct this problem.
安装过程有问题,重新安装
?
C、FAILED => to use the 'ssh' connection type with passwords,you must install the sshpass program
安装sshpass

下面关于Ansible的文章您也可能喜欢,不妨参考下:

CentOS下部署Ansible自动化对象?

在 CentOS 7 中安装并使用自动化对象 Ansible?

CentOS 7上搭建Jenkins+Ansible服务?

Linux下源码编译安装Ansible及排错记载?

Ansible根基—安装与常用模块?

Ansible设置装备摆设及使用?

自动化运维对象之 Ansible 介绍及安装使用?

自动化运维之Ansible详解?

Ansible入门notify和handlers?

CentOS 6.5安装自动化对象Ansible和图形化对象Tower?

Ansible 的详细先容:请点这里
Ansible 的下载地址:请点这里

本文永远更新链接地址

欢迎参与《LINUX学习:RHEL 6.6下安装Ansible》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读