1. 基础环境
apt update
apt install git python3-dev libffi-dev gcc libssl-dev
apt install python3-venv
2. 设置虚拟环境变量
root@controller01:~# python3 -m venv /deploy/venv
root@controller01:~# source /deploy/venv/bin/activate
(venv) root@controller01:~#
(venv) root@controller01:~# pip install -U pip
(venv) root@controller01:~# pip install 'ansible>=4,<6'
3.安装Kolla-ansible
pip install git+https://opendev.org/openstack/kolla-ansible@unmaintained/yoga
sudo mkdir -p /etc/kolla
sudo chown $USER:$USER /etc/kolla
cp -r /deploy/venv/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
cp /deploy/venv/share/kolla-ansible/ansible/inventory/* .
#虚拟环境变量需要在inventory中增加下面配置
localhost ansible_python_interpreter=python
```
(venv) root@controller01:/deploy# egrep -v '#|^$' all-in-one |more
[control]
localhost ansible_connection=local ansible_python_interpreter=python
[network]
localhost ansible_connection=local ansible_python_interpreter=python
[compute]
localhost ansible_connection=local ansible_python_interpreter=python
[storage]
localhost ansible_connection=local ansible_python_interpreter=python
[monitoring]
localhost ansible_connection=local ansible_python_interpreter=python
[deployment]
localhost ansible_connection=local ansible_python_interpreter=python
4. 配置globals.yml
#测试是否OK
ansible -i all-in-one all -m ping
#globals.yml配置
(venv) root@controller01:/deploy# egrep -v '#|^$' /etc/kolla/globals.yml
---
kolla_base_distro: "debian"
kolla_install_type: "source"
openstack_release: "yoga"
kolla_internal_vip_address: "100.192.1.23"
kolla_external_vip_address: "{{ kolla_internal_vip_address }}"
kolla_sysctl_conf_path: /etc/sysctl.conf
network_interface: "eth0"
neutron_external_interface: "eth1"
neutron_plugin_agent: "linuxbridge"
enable_haproxy: "no"
enable_cinder: "yes"
enable_cinder_backend_lvm: "yes"
enable_neutron_provider_networks: "yes"
nova_compute_virt_type: "kvm"
enable_neutron_qos: "yes"
enable_fluentd: "no"
neutron_tenant_network_types: "vlan"
enable_ironic: "yes"
ironic_dnsmasq_interface: "eth1"
ironic_dnsmasq_dhcp_range: "100.2.24.21,100.2.24.30,255.255.255.0"
ironic_dnsmasq_default_gateway: "100.2.24.1"
ironic_cleaning_network: pxe_999
ironic_dnsmasq_boot_file: "pxelinux.0"
ironic_dnsmasq_serve_ipxe: "no"
ironic_dnsmasq_dnsserver: "8.8.8.8,8.8.4.4"
ironic_inspector_kernel_cmdline_extras: ['ipa-lldp-timeout=30.0', 'ipa-collect-lldp=1', 'ipa-ntp-server=pool.ntp.org', 'ipa-debug=1']
5. 创建cinder-volumes卷
(venv) root@controller01:/deploy# pvremove /dev/sdd
Labels on physical volume "/dev/sdd" successfully wiped.
(venv) root@controller01:/deploy# pvcreate /dev/sdd
Physical volume "/dev/sdd" successfully created.
(venv) root@controller01:/deploy# vgcreate cinder-volumes /dev/sdd
Volume group "cinder-volumes" successfully created
(venv) root@controller01:/deploy#
6.开始部署
kolla-ansible install-deps
kolla-ansible -i ./all-in-one bootstrap-servers
kolla-ansible -i ./all-in-one prechecks
kolla-ansible -i ./all-in-one deploy
#生成openrc文件
kolla-ansible post-deploy
7. 设置source 环境变量
venv) root@controller01:~# cp /etc/kolla/admin-openrc.sh /root/
#安装
apt install python3-openstackclient
(venv) root@controller01:~# openstack compute service list
+----+----------------+--------------+----------+---------+-------+----------------------------+
| ID | Binary | Host | Zone | Status | State | Updated At |
+----+----------------+--------------+----------+---------+-------+----------------------------+
| 1 | nova-scheduler | controller01 | internal | enabled | up | 2024-05-25T11:39:18.000000 |
| 1 | nova-conductor | controller01 | internal | enabled | up | 2024-05-25T11:39:10.000000 |
| 6 | nova-compute | controller01 | nova | enabled | up | 2024-05-25T11:39:18.000000 |
+----+----------------+--------------+----------+---------+-------+----------------------------+
(venv) root@controller01:~#
8. 尝试清除缓存,重新执行
kolla-ansible destroy -i ./all-in-one --yes-i-really-really-mean-it