Skip to content

Commit 4725d97

Browse files
committed
created stackhpc-sushy-baremetal environment
1 parent f190830 commit 4725d97

File tree

15 files changed

+527
-84
lines changed

15 files changed

+527
-84
lines changed

etc/kayobe/environments/stackhpc-baremetal/ansible/baremetal-0-enroll-overcloud.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
1717

1818
- name: Ensure overcloud baremetal nodes are registered in ironic
19-
hosts: overcloud
19+
hosts: baremetal-overcloud
2020
gather_facts: false
2121
max_fail_percentage: >-
2222
{{ baremetal_compute_register_max_fail_percentage |

etc/kayobe/environments/stackhpc-baremetal/ansible/provision-overcloud.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
3+
dependencies:
4+
- ci-aio
5+
- stackhpc-baremetal
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
- name: Create Libvirt vBMC nodes
3+
gather_facts: false
4+
become: true
5+
hosts: sushy-libvirt
6+
tasks:
7+
- name: Gather facts
8+
setup:
9+
delegate_to: localhost
10+
11+
- name: Install Python requirements
12+
ansible.builtin.pip:
13+
name:
14+
- libvirt-python==11.3.0
15+
- lxml==5.4.0
16+
delegate_to: localhost
17+
18+
- name: Define vBMC storage pool
19+
community.libvirt.virt_pool:
20+
command: define
21+
name: default
22+
xml: "{{ lookup('template', sushy_directory + '/vbmc-pool.xml.j2') }}"
23+
delegate_to: localhost
24+
run_once: true
25+
26+
- name: Start vBMC storage pool
27+
community.libvirt.virt_pool:
28+
state: active
29+
name: default
30+
delegate_to: localhost
31+
run_once: true
32+
33+
- import_role:
34+
name: stackhpc.libvirt-vm
35+
vars:
36+
libvirt_vm_arch: x86_64
37+
libvirt_vms:
38+
- state: present
39+
name: "{{ inventory_hostname }}"
40+
xml_file: "{{ sushy_directory }}/vbmc-node.xml.j2"
41+
volumes:
42+
- name: '{{ inventory_hostname }}.qcow2'
43+
device: 'disk'
44+
format: 'qcow2'
45+
capacity: '20GB'
46+
pool: 'default'
47+
interfaces:
48+
- network: 'breth1'
49+
start: false
50+
autostart: false
51+
boot_firmware: uefi
52+
delegate_to: localhost
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
- name: Generate virtual baremetal MAC addresses
3+
hosts: sushy-libvirt
4+
gather_facts: false
5+
tasks:
6+
- name: Write hosts
7+
block:
8+
- name: Create address dictionary
9+
set_fact:
10+
bikolla_mac_addresses: "{{ bikolla_mac_addresses | combine({item: '52:54:00' | community.general.random_mac}) }}"
11+
vars:
12+
bikolla_mac_addresses: {}
13+
delegate_to: "{{ sushy_host | default('localhost') }}"
14+
with_items: "{{ play_hosts }}"
15+
16+
- name: Write mac addresses file
17+
copy:
18+
content: '{{ {"bikolla_mac_addresses": bikolla_mac_addresses} | to_nice_yaml }}'
19+
dest: "{{ kayobe_env_config_path }}/bikolla-mac-addresses.yml"
20+
delegate_to: "{{ sushy_host | default('localhost') }}"
21+
run_once: true
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
- name: Setup fake local_link_information
3+
hosts: sushy-libvirt-ipxe
4+
gather_facts: false
5+
tasks:
6+
- name: Get baremetal port metadata
7+
openstack.cloud.baremetal_port_info:
8+
node: "{{ inventory_hostname }}"
9+
delegate_to: localhost
10+
register: baremetal
11+
12+
- name: Setup local_link_information
13+
debug:
14+
msg: "{{ baremetal.ports[0] }}"
15+
16+
- name: Update baremetal port
17+
openstack.cloud.baremetal_port:
18+
state: present
19+
id: "{{ baremetal.ports[0].id }}"
20+
node: "{{ inventory_hostname }}"
21+
address: "{{ bikolla_mac_addresses[inventory_hostname] }}"
22+
is_pxe_enabled: true
23+
local_link_connection:
24+
switch_id: "{{ bikolla_mac_addresses[inventory_hostname] }}"
25+
port_id: "{{ baremetal.ports[0].id }}"
26+
switch_info: "{{ inventory_hostname }}"
27+
delegate_to: "{{ sushy_host | default('localhost') }}"
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
- name: Ensure Sushy Emulator is deployed
3+
hosts: "{{ sushy_host | default('localhost') }}"
4+
become: true
5+
gather_facts: false
6+
tasks:
7+
- name: Create Sushy configuration directory
8+
ansible.builtin.file:
9+
path: /etc/sushy
10+
state: directory
11+
12+
- name: Template Sushy configuration
13+
ansible.builtin.template:
14+
src: "{{ sushy_directory }}/sushy.conf.j2"
15+
dest: "/etc/sushy/sushy.conf"
16+
17+
- name: Enable Rocky devel repository
18+
community.general.dnf_config_manager:
19+
name: devel
20+
state: enabled
21+
22+
- name: Install package dependencies
23+
ansible.builtin.dnf:
24+
name:
25+
- qemu-kvm
26+
- libvirt
27+
- libvirt-devel
28+
- python3-devel
29+
state: present
30+
31+
- name: Start and enable the QEMU service
32+
ansible.builtin.systemd_service:
33+
name: virtqemud
34+
state: started
35+
enabled: true
36+
37+
- name: Start and enable the virtual stroage service
38+
ansible.builtin.systemd_service:
39+
name: virtstoraged
40+
state: started
41+
enabled: true
42+
43+
- name: Start and enable the virtual network service
44+
ansible.builtin.systemd_service:
45+
name: virtnetworkd
46+
state: started
47+
enabled: true
48+
49+
- name: Create Sushy virtualenv
50+
ansible.builtin.pip:
51+
name:
52+
- libvirt-python
53+
- sushy-tools
54+
virtualenv: /opt/kayobe/venvs/sushy
55+
virtualenv_command: python3 -m venv
56+
57+
- name: Template Sushy service unit file
58+
ansible.builtin.template:
59+
src: "{{ sushy_directory }}/sushyemud.service.j2"
60+
dest: "/etc/systemd/system/sushyemud.service"
61+
62+
- name: Start and enable the Sushy Emulator service
63+
ansible.builtin.systemd_service:
64+
name: sushyemud
65+
state: started
66+
enabled: true
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{% macro storage(uuid, enum, drive_id, end) -%}
2+
"{{ uuid }}": [
3+
{
4+
"Id": "{{ enum }}",
5+
"Name": "Local Storage Controller",
6+
"StorageControllers": [
7+
{
8+
"MemberId": "0",
9+
"Name": "Contoso Integrated RAID",
10+
"SpeedGbps": 12
11+
}
12+
],
13+
"Drives": [
14+
"{{ drive_id }}"
15+
]
16+
}
17+
]{% if not end %},{% endif %}
18+
{%- endmacro %}
19+
20+
{% macro drive(uuid, enum, drive_id, end) -%}
21+
("{{ uuid }}", "{{ enum }}"): [
22+
{
23+
"Id": "{{ drive_id }}",
24+
"Name": "Drive Sample",
25+
"CapacityBytes": 899527000000,
26+
"Protocol": "SAS"
27+
}
28+
]{% if not end %},{% endif %}
29+
{%- endmacro %}
30+
31+
{% macro volume(uuid, enum, hostname, end) -%}
32+
("{{ uuid }}", "{{ enum }}"): [ {
33+
"libvirtPoolName": "default",
34+
"libvirtVolName": "{{ hostname }}.qcow2",
35+
"Id": "{{ enum }}",
36+
"Name": "{{ hostname }}-volume",
37+
"VolumeType": "File",
38+
"CapacityBytes": 1073741824
39+
}
40+
]{% if not end %},{% endif %}
41+
{%- endmacro %}
42+
43+
SUSHY_EMULATOR_STORAGE = {
44+
{% for host in groups["sushy-libvirt"] %}
45+
{{ storage(host | to_uuid, 1, ('drive-'+host) | to_uuid, (host in groups["sushy-libvirt"] | last ) | bool) }}
46+
{% endfor %}
47+
}
48+
49+
SUSHY_EMULATOR_DRIVES = {
50+
{% for host in groups["sushy-libvirt"] %}
51+
{{ drive(host | to_uuid, 1, ('drive-'+host) | to_uuid, (host in groups["sushy-libvirt"] | last ) | bool) }}
52+
{% endfor %}
53+
}
54+
55+
SUSHY_EMULATOR_VOLUMES = {
56+
{% for host in groups["sushy-libvirt"] %}
57+
{{ volume(host | to_uuid, 1, host, (host in groups["sushy-libvirt"] | last ) | bool) }}
58+
{% endfor %}
59+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Unit]
2+
Description=Virtual Redfish BMC service
3+
4+
[Service]
5+
ExecStart=/opt/kayobe/venvs/sushy/bin/sushy-emulator -i 192.168.33.3 -p 34343 --config /etc/sushy/sushy.conf
6+
7+
[Install]
8+
WantedBy=multi-user.target default.target
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<network connections='1'>
2+
<name>vbmc-net</name>
3+
<uuid>{{ 'vbmc-net' | to_uuid }}</uuid>
4+
<forward mode='bridge'/>
5+
<bridge name='breth1'/>
6+
</network>

0 commit comments

Comments
 (0)