自动化kolla-ansible部署ubuntu20.04+openstack-victoria之裸金属-20

自动化kolla-ansible部署ubuntu20.04+openstack-victoria之裸金属-20

 

欢迎加QQ群:1026880196 进行交流学习

 

近期我发现网上有人转载或者复制原创博客内容,在此警告:

转载我博客应当经我允许,如果没有博客园账号,至少要把原文链接放在文章最前面,这是对本人辛苦原创基本的尊重。

 

#安装ironic 


1. 在 /etc/kolla/globals.yml配置
vim /etc/kolla/globals.yml

 

enable_horizon_ironic: "{{ enable_ironic | bool }}"
enable_ironic: "yes"
enable_nova_serialconsole_proxy: "yes"


ironic_dnsmasq_dhcp_range: "192.168.1.10,192.168.1.100" #随便定义一个,并不会用到
ironic_dnsmasq_interface: "ens35"
ironic_cleaning_network: "public1"
ironic_inspector_kernel_cmdline_extras: ['ipa-lldp-timeout=90.0', 'ipa-collect-lldp=1']

 

2. 配置内核与存储

source admin-openrc.sh
mkdir /etc/kolla/config/ironic
curl https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos8-stable-victoria.kernel -o /etc/kolla/config/ironic/ironic-agent.kernel
curl https://tarballs.opendev.org/openstack/ironic-python-agent/dib/files/ipa-centos8-stable-victoria.initramfs -o /etc/kolla/config/ironic/ironic-agent.initramfs

 

3. 创建部署内核和ramdis

openstack image create --disk-format aki --container-format aki --public --file /etc/kolla/config/ironic/ironic-agent.kernel deploy-vmlinuz
openstack image create --disk-format ari --container-format ari --public --file /etc/kolla/config/ironic/ironic-agent.initramfs deploy-initrd

 

4. 配置ironic.conf   #纳管dell 服务器配置清单  其他设备不支持
vim /etc/kolla/config/ironic.conf

[DEFAULT]
enabled_drivers = pxe_ipmitool_socat,pxe_ipmitool
enabled_hardware_types = redfish,idrac
enabled_power_interfaces = ipmitool,redfish,idrac-wsman,idrac,idrac-redfish
enabled_management_interfaces = ipmitool,redfish,idrac-wsman,idrac-redfish
enabled_network_interfaces = flat,neutron,noop
enabled_bios_interfaces = idrac-wsman,idrac-redfish,no-bios
enabled_raid_interfaces = idrac-wsman,idrac,no-raid
enabled_vendor_interfaces = idrac-wsman,idrac,idrac-redfish,no-vendor
enabled_inspect_interfaces = idrac-wsman,idrac,idrac-redfish,inspector,no-inspect
enabled_boot_interfaces = ipxe,pxe,idrac-redfish-virtual-media
enabled_console_interfaces = no-console
enabled_deploy_interfaces = iscsi,direct,ansible,ramdisk
enabled_rescue_interfaces = no-rescue,agent
enabled_storage_interfaces = noop,cinder,external


[conductor]
sync_power_state_interval = 10
power_state_sync_max_retries = 20
deploy_callback_timeout = 900
force_power_state_during_sync = true

[pxe]
pxe_append_params = coreos.autologin rd.auto=1 nofb nomodeset vga=normal console=ttyS0,115200n8

[disk_utils]
iscsi_verify_attempts = 30

 

5. 检查依赖

kolla-ansible -i ./multinode bootstrap-servers -vv


6. 对主机进行部署前检查

ansible -i multinode all -m ping
kolla-ansible -i ./multinode prechecks -vv


7. 安装部署

kolla-ansible -i ./multinode deploy -vv

 

8. 安装ironicclient

apt install python3-ironicclient python3-dracclient -y


9. 安装依赖

pip3 install 'python-dracclient>=3.1.0' 'sushy>=2.0.0'

 

10. 检查
[root@controller1 ~]#

openstack baremetal driver list 
nova service-list


如:

+---------------------+---------------------------------------+
| Supported driver(s) | Active host(s) |
+---------------------+---------------------------------------+
| idrac | controller3, controller2, controller1 |
| redfish | controller3, controller2, controller1 |
+---------------------+---------------------------------------+

root@controller1:~# nova service-list 
+--------------------------------------+----------------+--------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | Forced down |
+--------------------------------------+----------------+--------------------+----------+---------+-------+----------------------------+-----------------+-------------+
| 8d59816c-59ae-4bb6-9b1c-c09ea91028f2 | nova-scheduler | controller1 | internal | enabled | up | 2021-03-03T19:05:18.000000 | - | False |
| 47d940ee-12ba-40c6-ab1e-b68883c59221 | nova-scheduler | controller3 | internal | enabled | up | 2021-03-03T19:05:18.000000 | - | False |
| c5b99ae6-a2da-466f-b18e-6b36124bb861 | nova-scheduler | controller2 | internal | enabled | up | 2021-03-03T19:05:20.000000 | - | False |
| 7e2a81ae-67dc-4b53-aeea-af77c2f48cca | nova-conductor | controller1 | internal | enabled | up | 2021-03-03T19:05:21.000000 | - | False |
| ad93fe22-1acd-4f66-b4e0-d2fe8407b04f | nova-conductor | controller2 | internal | enabled | up | 2021-03-03T19:05:19.000000 | - | False |
| d4de37f2-da51-4c44-98c6-d63a6ce87c26 | nova-conductor | controller3 | internal | enabled | up | 2021-03-03T19:05:19.000000 | - | False |
| ff4c3555-0651-4e1d-ae1b-4bb6b774e93d | nova-compute | compute2 | nova | enabled | up | 2021-03-03T19:05:13.000000 | - | False |
| 82ed1ae7-659b-4f70-85c2-572f936515b4 | nova-compute | compute1 | nova | enabled | up | 2021-03-03T19:05:18.000000 | - | False |
| 6aebc11b-178b-4beb-9424-fd51d1459039 | nova-compute | controller1-ironic | nova | enabled | up | 2021-03-03T19:05:14.000000 | - | False |
| 9c3634fc-e2ab-4a09-997f-4ec751e98ede | nova-compute | controller2-ironic | nova | enabled | up | 2021-03-03T19:05:16.000000 | - | False |
| abc6630a-d8e0-4b3f-8eba-1d85679f70a4 | nova-compute | controller3-ironic | nova | enabled | up | 2021-03-03T19:05:16.000000 | - | False |
+--------------------------------------+----------------+--------------------+----------+---------+-------+----------------------------+-----------------+-------------+

 


11. 创建裸金属规格

openstack flavor create --ram 65535 --disk 232 --vcpus 24 dell-r630-01
如:
+----------------------------+--------------------------------------+
| Field                      | Value                                |
+----------------------------+--------------------------------------+
| OS-FLV-DISABLED:disabled   | False                                |
| OS-FLV-EXT-DATA:ephemeral  | 0                                    |
| disk                       | 232                                  |
| id                         | 33841c63-6f3a-4b12-b957-3cf0509d143c |
| name                       | dell-r630-01                         |
| os-flavor-access:is_public | True                                 |
| properties                 |                                      |
| ram                        | 65535                                |
| rxtx_factor                | 1.0                                  |
| swap                       |                                      |
| vcpus                      | 24                                   |
+----------------------------+--------------------------------------+

 

12. 创建接口

openstack flavor set --property resources:CUSTOM_BAREMETAL_RESOURCE_CLASS=1 dell-r630-01
openstack flavor set --property resources:VCPU=24 dell-r630-01
openstack flavor set --property resources:MEMORY_MB=65535 dell-r630-01
openstack flavor set --property resources:DISK_GB=232 dell-r630-01

 

13. 设置环境变量 (#欢迎加QQ群:1026880196 进行交流学习)

export IRONIC_API_VERSION=1.58

 

14.  创建baremetal node 

openstack baremetal node create --driver idrac --driver-info drac_username=root --driver-info drac_password=calvin  --driver-info drac_address=192.168.1.32  

 

如:
+------------------------+--------------------------------------------------------------------------------------+
| Field                  | Value                                                                                |
+------------------------+--------------------------------------------------------------------------------------+
| allocation_uuid        | None                                                                                 |
| automated_clean        | None                                                                                 |
| bios_interface         | no-bios                                                                              |
| boot_interface         | pxe                                                                                  |
| chassis_uuid           | None                                                                                 |
| clean_step             | {}                                                                                   |
| conductor              | controller2                                                                          |
| conductor_group        |                                                                                      |
| console_enabled        | False                                                                                |
| console_interface      | no-console                                                                           |
| created_at             | 2021-03-04T17:04:11+00:00                                                            |
| deploy_interface       | direct                                                                               |
| deploy_step            | {}                                                                                   |
| description            | None                                                                                 |
| driver                 | idrac                                                                                |
| driver_info            | {'drac_username': 'root', 'drac_password': '******', 'drac_address': '192.168.1.32'} |
| driver_internal_info   | {}                                                                                   |
| extra                  | {}                                                                                   |
| fault                  | None                                                                                 |
| inspect_interface      | no-inspect                                                                           |
| inspection_finished_at | None                                                                                 |
| inspection_started_at  | None                                                                                 |
| instance_info          | {}                                                                                   |
| instance_uuid          | None                                                                                 |
| last_error             | None                                                                                 |
| lessee                 | None                                                                                 |
| maintenance            | False                                                                                |
| maintenance_reason     | None                                                                                 |
| management_interface   | idrac-wsman                                                                          |
| name                   | None                                                                                 |
| network_data           | {}                                                                                   |
| network_interface      | flat                                                                                 |
| owner                  | None                                                                                 |
| power_interface        | idrac-wsman                                                                          |
| power_state            | None                                                                                 |
| properties             | {'cpus': 20, 'memory_mb': 49152, 'local_gb': 270, 'cpu_arch': 'x86_64'}              |
| protected              | False                                                                                |
| protected_reason       | None                                                                                 |
| provision_state        | enroll                                                                               |
| provision_updated_at   | None                                                                                 |
| raid_config            | {}                                                                                   |
| raid_interface         | no-raid                                                                              |
| rescue_interface       | no-rescue                                                                            |
| reservation            | None                                                                                 |
| resource_class         | baremetal-resource-class                                                             |
| retired                | False                                                                                |
| retired_reason         | None                                                                                 |
| storage_interface      | noop                                                                                 |
| target_power_state     | None                                                                                 |
| target_provision_state | None                                                                                 |
| target_raid_config     | {}                                                                                   |
| traits                 | []                                                                                   |
| updated_at             | None                                                                                 |
| uuid                   | 8f974a73-b2c7-4bea-85ab-33336187571e                                                 |
| vendor_interface       | no-vendor                                                                            |
+------------------------+--------------------------------------------------------------------------------------+

 

15. 查询对应的镜像ID

# kernel=deploy-vmlinuz
# initramfs=deploy-initrd

如:
+--------------------------------------+---------------------------------------+--------+
| ID                                   | Name                                  | Status |
+--------------------------------------+---------------------------------------+--------+
| 38ae3cc7-762a-4255-bf22-30516e67a436 | CentOS 6.5 64位                       | active |
| 0233c444-1af0-4145-97ad-6c812959b7e5 | CentOS 6.9 64位                       | active |
| 1ce58c4a-7d77-4041-b99f-d5d22934f7f5 | CentOS 7.6 64位                       | active |
| 31b87b08-2883-4be8-88f8-5e15bb2e3ed1 | Debian_Buster_10.2.0 64位             | active |
| 824bc2fe-698d-4e4c-96e2-d9e0b7357e3c | Ubuntu Server 18.04.4 LTS 64位        | active |
| afe4b772-c714-4635-997b-7f831b892484 | Windows Server 2012 R2 中文标准版64位 | active |
| f88f7aa3-3977-4f05-98e8-de0bf6e25129 | deploy-initrd                         | active |
| 9f8f1212-b7cf-4ac6-b06c-dcc9f7c2ac26 | deploy-vmlinuz                        | active |
+--------------------------------------+---------------------------------------+--------+

 

16.  查看创建的节点

openstack baremetal node list
如:
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID                                 | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 8f974a73-b2c7-4bea-85ab-33336187571e | None | None          | None        | enroll             | False       |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
+--------------------------------------+------+---------------+-------------+--------------------+-------------+

 

17. 创建节点端口  #iDRAC MAC 地址 = 84:7B:EB:D8:7B:CE 

openstack baremetal port create 84:7B:EB:D8:7B:CE --node 8f974a73-b2c7-4bea-85ab-33336187571e --physical-network physnet1
如
+-----------------------+--------------------------------------+
| Field                 | Value                                |
+-----------------------+--------------------------------------+
| address               | 84:7b:eb:d8:7b:ce                    |
| created_at            | 2021-03-04T17:07:16+00:00            |
| extra                 | {}                                   |
| internal_info         | {}                                   |
| is_smartnic           | False                                |
| local_link_connection | {}                                   |
| node_uuid             | 8f974a73-b2c7-4bea-85ab-33336187571e |
| physical_network      | None                                 |
| portgroup_uuid        | None                                 |
| pxe_enabled           | True                                 |
| updated_at            | None                                 |
| uuid                  | d99e00ec-a0bb-465f-8a04-a2e16e6591d1 |
+-----------------------+--------------------------------------+

 

18. 验证

openstack baremetal node show  8f974a73-b2c7-4bea-85ab-33336187571e
如:
+------------------------+--------------------------------------------------------------------------------------+
| Field                  | Value                                                                                |
+------------------------+--------------------------------------------------------------------------------------+
| allocation_uuid        | None                                                                                 |
| automated_clean        | None                                                                                 |
| bios_interface         | no-bios                                                                              |
| boot_interface         | pxe                                                                                  |
| chassis_uuid           | None                                                                                 |
| clean_step             | {}                                                                                   |
| conductor              | controller2                                                                          |
| conductor_group        |                                                                                      |
| console_enabled        | False                                                                                |
| console_interface      | no-console                                                                           |
| created_at             | 2021-03-04T17:04:11+00:00                                                            |
| deploy_interface       | direct                                                                               |
| deploy_step            | {}                                                                                   |
| description            | None                                                                                 |
| driver                 | idrac                                                                                |
| driver_info            | {'drac_username': 'root', 'drac_password': '******', 'drac_address': '192.168.1.32'} |
| driver_internal_info   | {}                                                                                   |
| extra                  | {}                                                                                   |
| fault                  | None                                                                                 |
| inspect_interface      | no-inspect                                                                           |
| inspection_finished_at | None                                                                                 |
| inspection_started_at  | None                                                                                 |
| instance_info          | {}                                                                                   |
| instance_uuid          | None                                                                                 |
| last_error             | None                                                                                 |
| lessee                 | None                                                                                 |
| maintenance            | False                                                                                |
| maintenance_reason     | None                                                                                 |
| management_interface   | idrac-wsman                                                                          |
| name                   | None                                                                                 |
| network_data           | {}                                                                                   |
| network_interface      | flat                                                                                 |
| owner                  | None                                                                                 |
| power_interface        | idrac-wsman                                                                          |
| power_state            | None                                                                                 |
| properties             | {'cpus': 20, 'memory_mb': 49152, 'local_gb': 270, 'cpu_arch': 'x86_64'}              |
| protected              | False                                                                                |
| protected_reason       | None                                                                                 |
| provision_state        | enroll                                                                               |
| provision_updated_at   | None                                                                                 |
| raid_config            | {}                                                                                   |
| raid_interface         | no-raid                                                                              |
| rescue_interface       | no-rescue                                                                            |
| reservation            | None                                                                                 |
| resource_class         | baremetal-resource-class                                                             |
| retired                | False                                                                                |
| retired_reason         | None                                                                                 |
| storage_interface      | noop                                                                                 |
| target_power_state     | None                                                                                 |
| target_provision_state | None                                                                                 |
| target_raid_config     | {}                                                                                   |
| traits                 | []                                                                                   |
| updated_at             | 2021-03-04T17:07:16+00:00                                                            |
| uuid                   | 8f974a73-b2c7-4bea-85ab-33336187571e                                                 |
| vendor_interface       | no-vendor                                                                            |
+------------------------+--------------------------------------------------------------------------------------+

 

19. 纳管

openstack baremetal node manage 8f974a73-b2c7-4bea-85ab-33336187571e
openstack baremetal node provide 8f974a73-b2c7-4bea-85ab-33336187571e

 

20. 验证

openstack baremetal node list
如:
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| UUID                                 | Name | Instance UUID | Power State | Provisioning State | Maintenance |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+
| 8f974a73-b2c7-4bea-85ab-33336187571e | None | None          | power on    | available          | False       |
+--------------------------------------+------+---------------+-------------+--------------------+-------------+

 

 

 

 

posted @ 2021-04-04 00:37  星空之源  阅读(1317)  评论(0编辑  收藏  举报