我尝试按照此链接在运行 CentOS 8.3.2011 的虚拟机上部署 OpenStack,但在运行命令时在预检查阶段出现错误:
kolla-ansible -i ./all-in-one prechecks
错误消息是:
TASK [rabbitmq : Check if each rabbit hostname resolves uniquely to the proper IP address] *****************************failed: [localhost] (item=[{'cmd': ['getent', 'ahostsv4', 'localhost'], 'stdout': '127.0.0.1 STREAM localhost\n127.0.0.1 DGRAM \n127.0.0.1 RAW \n127.0.0.1 STREAM \n127.0.0.1 DGRAM \n127.0.0.1 RAW \n192.168.56.103 STREAM \n192.168.56.103 DGRAM \n192.168.56.103 RAW ', 'stderr': '', 'rc': 0, 'start': '2021-05-28 07:48:12.453408', 'end': '2021-05-28 07:48:12.455955', 'delta': '0:00:00.002547', 'changed': False, 'invocation': {'module_args': {'_raw_params': 'getent ahostsv4 localhost', 'warn': True, '_uses_shell': False, 'stdin_add_newline': True, 'strip_empty_ends': True, 'argv': None, 'chdir': None, 'executable': None, 'creates': None, 'removes': None, 'stdin': None}}, 'stderr_lines': [], 'failed': False, 'item': 'localhost', 'ansible_loop_var': 'item'}, '127.0.0.1 STREAM localhost']) => {"ansible_loop_var": "item", "changed": false, "item": [{"ansible_loop_var": "item", "changed": false, "cmd": ["getent", "ahostsv4", "localhost"], "delta": "0:00:00.002547", "end": "2021-05-28 07:48:12.455955", "failed": false, "invocation": {"module_args": {"_raw_params": "getent ahostsv4 localhost", "_uses_shell": false, "argv": null, "chdir": null, "creates": null, "executable": null, "removes": null, "stdin": null, "stdin_add_newline": true, "strip_empty_ends": true, "warn": true}}, "item": "localhost", "rc": 0, "start": "2021-05-28 07:48:12.453408", "stderr": "", "stderr_lines": [], "stdout": "127.0.0.1 STREAM localhost\n127.0.0.1 DGRAM \n127.0.0.1 RAW \n127.0.0.1 STREAM \n127.0.0.1 DGRAM \n127.0.0.1 RAW \n192.168.56.103 STREAM \n192.168.56.103 DGRAM \n192.168.56.103 RAW "}, "127.0.0.1 STREAM localhost"], "msg": "Hostname has to resolve uniquely to the IP address of api_interface"}
我该如何解决这个问题?
我最近在控制节点中遇到了这个问题,其中预检查最终显示了我的计算节点的故障状态。我查看了它的 /etc/hosts 文件,其中有一个主机名的两个条目(在我的例子中是 ubuntu)。
# BEGIN ANSIBLE GENERATED HOSTS
192.168.3.133 ubuntu
192.168.3.137 ubuntu
# END ANSIBLE GENERATED HOSTS
我手动编辑了该文件,使其仅包含一个条目(针对用户名 ubuntu 的主接口 IP)。
# BEGIN ANSIBLE GENERATED HOSTS
192.168.3.133 ubuntu
# END ANSIBLE GENERATED HOSTS
它有效并且预检查阶段成功。
最好正确设置测试机器的主机名以避免此错误。这就是我所做的。
sudo hostnamectl set-主机名 openstack-aio
然后检查 /etc/hosts 它应该有一个 localhost 条目和另一个新主机名条目。
不要忘记注销/登录,以便您的 shell 看到新的主机名。
编辑
/etc/hosts
文件。注释掉上面两行并根据您的 ip 到 localhost 进行输入
[root@localhost ~]# cat /etc/hosts
#127.0.0.1 localhost
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.122.73 localhost
[root@localhost ~]#