基于kolla-ansible在openEuler 22.03 SP4上部署OpenStack-2023.2

测试环境

openEuler-22.03-LTS-SP4-x86_64-dvd.iso

Virtual Box,4 vCPU, 8G RAM, 50 vDisk。安装时删除/home,SWAP分区,全部空间给/目录。

目标是部署OpenStack All-In-One模式,控制节点+计算节点+存储节点在一台机器实现。

系统配置

常用工具

dnf install -y tar git

优化SSH

vi /etc/ssh/sshd_config

UseDNS no

systemctl restart sshd

关闭selinux

sed -i 's#SELINUX=enforcing#SELINUX=permissive#g' /etc/selinux/config

关闭防火墙

systemctl disable --now firewalld

systemctl stop firewalld

systemctl status firewalld

设置主机名,配置hosts文件

hostnamectl set-hostname node1

cat << EOF >> /etc/hosts

192.168.31.115 node1

EOF

设置免密登录

ssh-keygen

ssh-copy-id node1

重启系统

system reboot

安装docker

vi /etc/yum.repos.d/openEuler-docker-ce.repo

[docker-ce-stable]
name=Docker CE Stable - b a s e a r c h b a s e u r l = h t t p s : / / r e p o . h u a w e i c l o u d . c o m / d o c k e r − c e / l i n u x / c e n t o s / 8 / basearch baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/8/ basearchbaseurl=https://repo.huaweicloud.com/docker−ce/linux/centos/8/basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg

dnf install -y docker-ce

指定docker加速器,阿里云申请免费

mkdir -p /etc/docker

tee /etc/docker/daemon.json << 'EOF'

{

"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]

}

EOF

systemctl daemon-reload

#启动docker服务

systemctl start docker

systemctl enable docker

systemctl status docker

docker info

docker --version

安装Python docker模块

pip3 install docker

安装ansible

更换pip国内源,加速pip下载安装

mkdir ~/.pip

vi ~/.pip/pip.conf

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]

trusted-host = pypi.tuna.tsinghua.edu.cn

pip3 install ansible

ansible --version

安装后的版本是ansible-8.7.0 + ansible [core 2.15.12]

优化ansible

mkdir /etc/ansible

vi /etc/ansible/ansible.cfg

[defaults]

host_key_checking=False

pipelining=True

forks=100

安装kolla-ansible

安装kolla-ansible需要的依赖

dnf install -y python3-devel libffi-devel gcc openssl-devel python3-libselinux

安装kolla-ansible

kolla-ansible与OpenStack之间版本信息:https://docs.openstack.org/releasenotes/kolla-ansible/

pip3 install pbr

pip3 install kolla-ansible==17.5.0

kolla-ansible --version

从Yoga版本开始需要安装Ansible Galaxy的依赖项

kolla-ansible install-deps

部署OpenStack

创建kolla-ansible配置文件目录

mkdir /etc/kolla

chown U S E R : USER: USER:USER /etc/kolla

配置文件

cp /usr/local/share/kolla-ansible/etc_examples/kolla/globals.yml /etc/kolla/

cp /usr/local/share/kolla-ansible/etc_examples/kolla/passwords.yml /etc/kolla/

cp /usr/local/share/kolla-ansible/ansible/inventory/all-in-one /etc/kolla/

编辑all-in-one

sed -i 's#localhost ansible_connection=local#node1 ansible_python_interpreter=/usr/bin/python3#g' /etc/kolla/all-in-one

生成密码

kolla-genpwd

编辑globals.yml

cat /etc/kolla/globals.yml|grep -v ^#|grep -v ^$

workaround_ansible_issue_8743: yes
kolla_base_distro: "rocky"
openstack_release: "2023.2"
openstack_tag: "2023.2-rocky-9"
node_custom_config: "/etc/kolla/config"
kolla_internal_vip_address: "192.168.31.115"
network_interface: "enp0s3"
neutron_external_interface: "enp0s8"
enable_haproxy: "no"
enable_neutron_provider_networks: "yes"
nova_compute_virt_type: "qemu"

部署安装指定版本库,避免报错。

pip3 install pyOpenSSL==24.2.1

pip3 install cryptography==42.0.0

pip3 install paramiko==3.0.0

已安装过docker,注释掉kolla自动安装docker的任务

vi /root/.ansible/collections/ansible_collections/openstack/kolla/roles/docker/defaults/ main.yml

enable_docker_repo: false

vi /root/.ansible/collections/ansible_collections/openstack/kolla/roles/docker/tasks/main.yml

#- import_tasks: install.yml

kolla-ansible -i /etc/kolla/all-in-one bootstrap-servers

kolla-ansible -i /etc/kolla/all-in-one prechecks

kolla-ansible -i /etc/kolla/all-in-one deploy

kolla-ansible -i /etc/kolla/all-in-one post-deploy

服务验证

安装openstack客户端

dnf install -y python3-openstackclient

source /etc/kolla/admin-openrc.sh

openstack user list

openstack endpoint list

openstack project list

openstack service list

openstack volume type list

openstack network agent list

openstack compute service list

openstack volume service list

openstack hypervisor list --long

通过浏览器登录到192.168.31.115页面验证Horizon。

部署虚机

openstack flavor create cirros --ram 1024 --vcpus 1 --disk 10

openstack security group create srGrp

openstack image create cirros-0.6.2 --disk-format qcow2 --container-format bare --public --file cirros-0.6.2-x86_64-disk.img

openstack network create oamNet --provider-network-type=vxlan

openstack subnet create oamSubnetv4 --network oamNet --subnet-range 10.16.151.0/24 --gateway 10.16.151.1 --allocation-pool start=10.16.151.5,end=10.16.151.254 --ip-version 4 --no-dhcp

openstack server create --availability-zone nova --image cirros-0.6.2 --flavor cirros --network oamNet --security-group srGrp cirros

openstack network list

openstack image list

openstack subnet list

openstack security group list

openstack server list

openstack flavor list

移除环境

如果需要移除当前的OpenStack环境,可以执行

kolla-ansible -i /etc/kolla/all-in-one destroy all --yes-i-really-really-mean-it

相关推荐
紫晓宁21 小时前
jmeter结合ansible分布式压测--3压测执行
分布式·jmeter·ansible
紫晓宁2 天前
jmeter结合ansible分布式压测--1数据准备
分布式·jmeter·ansible
紫晓宁2 天前
jmeter结合ansible分布式压测--2jmter环境准备
分布式·jmeter·ansible
mqiqe3 天前
云计算Openstack 虚拟机调度策略
云计算·openstack
SG.xf5 天前
ansible中的任务执行控制
ansible
小安运维日记7 天前
Linux云计算 |【第五阶段】CLOUD-DAY2
linux·运维·云计算·openstack
赶紧回家去8 天前
Ansible基本使用
运维·ansible
我就是全世界9 天前
ansible详细介绍和具体步骤
ansible
福大大架构师每日一题9 天前
27.9 调用go-ansible执行playbook拷贝json文件重载采集器
golang·json·ansible·prometheus
SG.xf9 天前
Ansible
运维·ansible