kolla-ansible 部署 openstack 遇到的问题以及解决方法

1、 ./generate_passwords.py 报错 AttributeError: 'module' object has no attribute '_ssh_write_string'
解决方法

sudo apt install python-pip sudo pip install -U pyopenssl

2、TASK [prechecks : Checking Docker version]: The conditional check 'inventory_hostname in groups['baremetal']' failed. The error was: error while evaluating conditional (inventory_hostname in groups['baremetal']): Unable to look up a name or access an attribute in template string
解决方法:
不要注释 baremetal
[baremetal:children]

3、TASK [rabbitmq : Check if all rabbit hostnames are resolvable]: failed: [uat-ctl03] (item=uat-ctl01) => {"changed": false, "cmd": ["getent", "ahostsv4", "uat-ctl01"], "delta": "0:00:00.009165", "end": "2020-06-24 19:03:07.755371", "item": "uat-ctl01", "msg": "non-zero return code", "rc": 2, "start": "2020-06-24 19:03:07.746206", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
解决方法:修改所有节点的 /etc/hosts 文件,增加其他节点的 hostname 解析
4、TASK [neutron : Checking if ‘MountFlags’ for docker service is set to ‘shared’]
解决方法:
gtw 节点
cat /etc/systemd/system/docker.service.d/kolla.conf ... [Service] MountFlags=shared ...

systemctl daemon-reload && systemctl restart docker && systemctl status docker

5、TASK [prometheus: Copying over config.json files]
解决方法:
mutinode 增加 ansible_become=yes
... [all:vars] ansible_user=demon ansible_ssh_pass=123456 ansible_sudo_pass=123456 ansible_become=yes

6、安装 pip install python-openstackclient 遇到的问题
pip install python-openstackclient: Couldn't find index page for 'pbr' (maybe misspelled?)
解决方法
pip install pbr

pip install python-openstackclient:Couldn't find index page for 'setuptools_scm' (maybe misspelled?)
解决方法
pip install setuptools_scm

Collecting cmd2!=0.8.3,>=0.8.0 (from cliff!=2.9.0,>=2.8.0->python-openstackclient) Downloading ? /usr/lib64/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
解决方法
pip install --upgrade pip pip install --upgrade setuptools

pip cannot uninstall ipaddress: “It is a distutils installed project”
解决方法
yum remove python-ipaddress yum install pip pip install python-openstackclient

7、openstack 使用 vlan,那么需要修改 cmp 以及 gtw 节点中的配置,重启相关 docker,否则创建外部网络 vlan 类型时,没有指定 network_vlan_ranges ,会出错
修改 gtw 节点 /etc/kolla/neutron-openvswitch-agent/ml2_conf.ini
ansible network -i ../../multinode -m shell -a "sed -i 's/^network_vlan_ranges.*/network_vlan_ranges = physnet1/' /etc/kolla/neutron-openvswitch-agent/ml2_conf.ini" --become

修改 cmp 节点 /etc/kolla/neutron-openvswitch-agent/ml2_conf.ini
ansible virtualization -i ../../multinode -m shell -a "sed -i 's/^network_vlan_ranges.*/network_vlan_ranges = physnet1/' /etc/kolla/neutron-openvswitch-agent/ml2_conf.ini" --become

重启 gtw 节点 neutron_openvswitch_agent
ansible network -i ../../multinode -m shell -a "docker restart neutron_openvswitch_agent" --become

重启 cmp 节点 neutron_openvswitch_agent
ansible virtualization -i ../../multinode -m shell -a "docker restart neutron_openvswitch_agent" --become

修改 gtw 节点 /etc/kolla/neutron-server/ml2_conf.ini
ansible network -i ../../multinode -m shell -a "sed -i 's/^network_vlan_ranges.*/network_vlan_ranges = physnet1/' /etc/kolla/neutron-server/ml2_conf.ini" --become

重启 gtw 节点 neutron_openvswitch_agent
ansible network -i ../../multinode -m shell -a "docker restart neutron_server neutron_openvswitch_agent" --become

8、修改 global.yml 或者 multinode 文件后,需要重新执行 bootstrap-servers、prechecks
9、 destroy 集群的时候出错
TASK [destroy : Destroying all Kolla containers and volumes] Docker will not be able to stop the nova_libvirt container with those running
【kolla-ansible 部署 openstack 遇到的问题以及解决方法】解决方法: 用命令删除 nova_libvirt
ansible virtualization -i ../../multinode -m shell -a "docker stop nova_libvirt" --become ansible virtualization -i ../../multinode -m shell -a "docker rm nova_libvirt" --become

    推荐阅读