安装Ansible
1.安装EPEL源
yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epelrelease-7-5.noarch.rpm
2.yum install -y ansible
或者用rpm方式安装,需要六个包:
rpm -ivh python-keyczar-0.71c-2.el7.noarch.rpm
rpm -ivh sshpass-1.05-5.el7.x86_64.rpm
rpm -ivh python-httplib2
rpm -ivh python-jinja2
rpm -ivh python-paramiko
rpm -ivh ansible1.9-1.9.4-2.el7.noarch.rpm
验证:
ansible --version
常见问题:
1.key文件问题及解决方法
a.key文件不是最新
cd /etc/pki/rpm-gpg
wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #下载最新的签名
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* #导入签名key
b.key文件不存在
GPG key retrieval failed: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY*
修改源配置中gpgcheck=0
find .|xargs grep -ri "RPM-GPG-KEY-CentOS-SIG-Cloud" #查找需要修改的文件
find .|xargs grep -ri "RPM-GPG-KEY-CentOS-SIG-Cloud" -l
安装openstack-ansible
git clone -b TAG https://github.com/openstack/openstack-ansible.git /opt/openstack-ansible
cd /opt/openstack-ansible
sh scripts/bootstrap-ansible.sh