Error: Failed to apply catalog: Execution of '/usr/bin/openstack project list --quiet --format csv --long' returned 1: 'ascii' codec can't encode characters in position 8-9: ordinal not in range(128)
You will find full trace in log /var/tmp/packstack/20181111-105444-_ACQdo/manifests/192.168.240.234_controller.pp.log
cd /usr/lib/python2.7/site-packages/
修改(如果不存在就创建一个)
cat <<EOF > sitecustomize.py
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
EOF
再运行安装就行了。
#!/bin/bash
chkconfig NetworkManager off
chkconfig firewalld off
service NetworkManager stop
setenforce 0
service firewalld stop
sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config
sed -e "s/^metalink=/#metalink=/g" \
-e "s/^mirrorlist=http/#mirrorlist=http/g" \
-e "s@^#baseurl=@baseurl=@g" \
-i /etc/yum.repos.d/*.repo
cat <<EOF >>/etc/hosts
192.168.239.241 mirror.centos.org
EOF
yum update -y
#yum reinstall https://rdoproject.org/repos/rdo-release.rpm -y
wget https://repos.fedorapeople.org/repos/openstack/openstack-rocky/rdo-release-rocky-0.noarch.rpm
yum localinstall -y rdo-release-rocky-0.noarch.rpm
yum reinstall centos-release-openstack-rocky -y
yum reinstall openstack-packstack -y
yum install ansible -y
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
#packstack --default-password=123456 --gen-answer-file answers.txt
cat <<EOF >/root/answers.yml
- hosts: localhost
tasks:
# - lineinfile:
# path: answers.txt
# regexp: "^CONFIG_KEYSTONE_ADMIN_PW"
# line: "CONFIG_KEYSTONE_ADMIN_PW=gtland2019"
- lineinfile:
path: answers.txt
regexp: "^CONFIG_CINDER_VOLUMES_CREATE"
line: "CONFIG_CINDER_VOLUMES_CREATE=n"
- lineinfile:
path: answers.txt
regexp: "^CONFIG_NEUTRON_ML2_VNI_RANGES="
line: "CONFIG_NEUTRON_ML2_VNI_RANGES=10:1000"
- lineinfile:
path: answers.txt
regexp: "^CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS"
line: "CONFIG_NEUTRON_OVS_BRIDGE_MAPPINGS=extnet:br-ex"
- lineinfile:
path: answers.txt
regexp: "^CONFIG_NEUTRON_OVS_BRIDGE_IFACES"
line: "CONFIG_NEUTRON_OVS_BRIDGE_IFACES=br-ex:eno3"
- lineinfile:
path: answers.txt
regexp: "^CONFIG_COMPUTE_HOSTS"
line: "CONFIG_COMPUTE_HOSTS=192.168.240.234,192.168.240.233,192.168.240.232"
EOF
ansible-playbook /root/answers.yml
packstack --answer-file=/root/answers.txt
#reboot
#cd /usr/lib/python2.7/site-packages/
cat <<EOF > sitecustomize.py
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
EOF