先关掉防火墙和SELinux
systemctl disable firewalld
vi /etc/sysconfig/selinux
SELINUX=disabled
重启系统
yum install epel-release
yum install python-pip
pip install -U pip
安装依赖
yum install python-devel libffi-devel gcc openssl-devel libselinux-python
pip install -U ansible
curl -sSL https://get.docker.io | bash
CentOS 7开始用Systemd取代之前的SysVinit作为初始化系统,Ubuntu系统用的是upstart,参考官网配置时注意区分。
systemctl enable docker
systemctl start docker
pip install -U docker
在实际多node部署时,时间同步很重要,但这里是all-in-one环境,所以NTP不是必须的。
yum install ntp
systemctl enable ntpd.service
systemctl start ntpd.service
ntpd -gq
timedatectl set-timezone Asia/Shanghai
[root@tacker-ansible ~]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 Dec 8 17:20 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
# Create the drop-in unit directory for docker.service
mkdir -p /etc/systemd/system/docker.service.d
# Create the drop-in unit file
tee /etc/systemd/system/docker.service.d/kolla.conf <<-'EOF'
[Service]
MountFlags=shared
EOF
pip install kolla-ansible
cp -r /usr/share/kolla-ansible/etc_examples/kolla /etc/kolla/
cp /usr/share/kolla-ansible/ansible/inventory/* .
egrep -c '(vmx|svm)' /proc/cpuinfo
mkdir -p /etc/kolla/config/nova
cat << EOF > /etc/kolla/config/nova/nova-compute.conf
[libvirt]
virt_type = qemu
cpu_mode = none
EOF
wget https://tarballs.openstack.org/kolla/images/centos-source-registry-pike.tar.gz
mkdir /Users/alexli/kolla_registry
sudo tar xzf centos-binary-registry-ocata.tar.gz -C /Users/alexli/kolla_registry
git clone https://github.com/openstack/kolla
vi tools/start-registry
#!/bin/bash
docker run -d \
--name registry \
--restart=always \
-p 5000:5000 \
-v /Users/alexli/kolla_registry:/var/lib/registry \
registry:2
cd kolla
tools/start-registry
curl -X GET http://192.168.56.1:5000/v2/_catalog
curl -X GET http://192.168.56.1:5000/v2/lokolla/centos-source-mongodb/tags/list
{"name":"lokolla/centos-source-mongodb","tags":["5.0.1"]}
vi /etc/sysconfig/docker
INSECURE_REGISTRY="--insecure-registry 192.168.56.1:5000”
vi /etc/docker/daemon.json
{
"insecure-registries": ["192.168.56.1:5000"]
}
systemctl daemon-reload
systemctl restart docker
docker pull 192.168.56.1:5000/lokolla/centos-source-mongodb:5.0.1
kolla_install_type: “source” #开发用环境,用source
openstack_release: "" # 留空,kolla会根据kolla-ansible版本自动填
kolla_internal_vip_address: “192.168.56.101”
docker_registry: "192.168.56.1:5000" #刚刚配置的私有registry
Docker_namespace: “lokolla” #官网下载的就是这个名字
enable_glance: "no"
enable_haproxy: "no"
enable_keystone: "yes"
enable_mariadb: "yes"
enable_memcached: "yes"
enable_neutron: "no"
enable_nova: "no"
enable_barbican: "yes"
enable_mistral: "yes"
enable_tacker: "yes"
enable_heat: "no"
enable_openvswitch: "no"
enable_horizon: "yes"
enable_horizon_tacker: "{{ enable_tacker | bool }}"
kolla-ansible prechecks -i ./all-in-one
kolla-genpw
kolla-ansible deploy -i ./all-in-one
PLAY RECAP ************************************************************************************************************************************
localhost : ok=267 changed=57 unreachable=0 failed=0
kolla-ansible post-deploy
pip install python-openstackclient
tacker_services:
tacker-server:
container_name: "tacker_server"
group: "tacker-server"
enabled: true
image: "{{ tacker_server_image_full }}"
volumes:
- "{{ node_config_directory }}/tacker-server/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"
- "{{ kolla_dev_repos_directory ~ '/tacker/tacker:/var/lib/kolla/venv/lib/python2.7/site-packages/tacker' if tacker_dev_mode | bool else '' }}"
- "kolla_logs:/var/log/kolla/“
…
####################
# Kolla
####################
tacker_git_repository: "{{ kolla_dev_repos_git }}/{{ project_name }}"
tacker_dev_repos_pull: "{{ kolla_dev_repos_pull }}"
tacker_dev_mode: "{{ kolla_dev_mode }}”
---
- name: Cloning source repositories for development
git:
repo: "{{ tacker_git_repository }}"
dest: "{{ kolla_dev_repos_directory }}/{{ project_name }}"
update: "{{ tacker_dev_repos_pull }}”
- include: clone.yml
when:
- tacker_dev_mode | bool
- inventory_hostname in groups['tacker-server’]
tacker_dev_mode: true
TASK [tacker : include] ***********************************************************************************************************************
included: /usr/share/kolla-ansible/ansible/roles/tacker/tasks/clone.yml for localhost
TASK [tacker : Cloning source repositories for development] ***********************************************************************************
changed: [localhost]
[root@tacker-ansible tacker]# ll /opt/stack/
total 4
drwxr-xr-x 13 root root 4096 Dec 16 20:01 tacker
docker stop $(docker ps -q)
kolla-ansible -i ./all-in-one destroy --yes-i-really-really-mean-it
reboot now
fatal: [localhost]: FAILED! => {"changed": true, "msg": "'Traceback (most recent call last):\\n File \"/tmp/ansible_S7JoMg/ansible_module_kolla_docker.py\", line 795, in main\\n dw = DockerWorker(module)\\n File \"/tmp/ansible_S7JoMg/ansible_module_kolla_docker.py\", line 218, in __init__\\n self.dc = get_docker_client()(**options)\\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 149, in __init__\\n self._version = self._retrieve_server_version()\\n File \"/usr/lib/python2.7/site-packages/docker/api/client.py\", line 176, in _retrieve_server_version\\n \\'Error while fetching server API version: {0}\\'.format(e)\\nDockerException: Error while fetching server API version: (\\'Connection aborted.\\', error(2, \\'No such file or directory\\'))\\n’"}
2.kolla-ansible版本跟依赖的Jinja2版本不匹配,错误提示找不到“equalto” filter。单就这个问题,可以手工将“equalto”替换为“match”。
TASK [keystone : Creating admin project, user, role, service, and endpoint]
CRITICAL keystone [-] Unhandled error: ProgrammingError: (pymysql.err.ProgrammingError) (1146, u\"Table 'keystone.project' doesn't exist\”)
原因是上次keystone任务只执行了一半,mariadb中keystone数据库建立了,但是没有表。把keystone数据库删除后 重新跑就ok
docker exec kolla_toolbox openstack --os-interface internal --os-auth-url http://192.168.56.254:35357 --os-identity-api-version 3 --os-project-domain-name default --os-tenant-name admin --os-username admin --os-password xEZhAqFwlM8LPf55OH6a3lTaHa6QV0TYcQcB1lUe --os-user-domain-name default compute service list
用ip addr看看是否旧环境的接口还被占着,如果是,重启host,再部署
错误的
docker pull http://192.168.56.1:5000/v2/lokolla/centos-source-mongodb
正确的
docker pull 192.168.56.1:5000/lokolla/centos-source-mongodb:5.0.1
7. cannot import name UnrewindableBodyError
解决办法
pip uninstall urllib3
pip install urllib3
8. Hostname has to resolve to IP address of api_interface
192.168.56.101 localhost
9. 服务启动失败
TASK [*** : Running *** bootstrap container]
fatal: [localhost]: FAILED! => {"changed": true, "msg": "Container exited with non-zero return code”}