Skip to content

Commit f83cfa4

Browse files
claudia-lolarocky Cloud User
authored andcommitted
added auto-setup playbook for sushy env, edits for baremetal env playbooks
1 parent 0e41ba3 commit f83cfa4

File tree

8 files changed

+109
-42
lines changed

8 files changed

+109
-42
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#todo

etc/kayobe/environments/stackhpc-baremetal/ansible/baremetal-3-ensure-agent-inspect.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@
6767
failed_when:
6868
- node_set.rc != 0
6969
changed_when: true
70-
# do it slowly due to ironic api issues
71-
throttle: 3
7270
when:
7371
- provision_state == "inspect failed"
7472
- kayobe_agent_inspect_done == ""
@@ -81,8 +79,6 @@
8179
failed_when:
8280
- node_set.rc != 0
8381
changed_when: true
84-
# do it slowly due to ironic api issues
85-
throttle: 3
8682
when:
8783
- kayobe_agent_inspect_done == ""
8884
- inspect_interface == "redfish"
@@ -95,8 +91,6 @@
9591
failed_when:
9692
- node_set.rc != 0
9793
changed_when: true
98-
# do it slowly due to ironic api issues
99-
throttle: 3
10094
when:
10195
- kayobe_agent_inspect_done == ""
10296

etc/kayobe/environments/stackhpc-baremetal/ansible/diagnose-baremetal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
- name: Node enrolment health check
3-
hosts: baremetal-compute
3+
hosts: baremetal
44
gather_facts: false
55
connection: local
66
vars:

etc/kayobe/environments/stackhpc-baremetal/ansible/download-host-image.yml

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,54 +33,59 @@
3333
force_basic_auth: true
3434
unredirected_headers:
3535
- Authorization
36-
dest: /tmp/{{ overcloud_host_image_name }}.qcow2
36+
#dest: /tmp/{{ overcloud_host_image_name }}.qcow2
37+
dest: "/var/lib/docker/volumes/ironic/_data/{{ overcloud_host_image_name }}.qcow2"
38+
tmp_dest: "/var/lib/docker/volumes/ironic/_data/"
3739
mode: "0644"
3840
register: image_download_result
39-
until: image_download_result.status_code in [200, 304]
40-
retries: 3
41-
delay: 60
41+
# until: image_download_result.status_code in [200, 304]
42+
# retries: 3
43+
# delay: 60
44+
become: true
4245

4346
#NOTE(jake): It would be nice to get the *real* checksum from Ark eventually.
44-
- name: Get checksum of file
45-
ansible.builtin.stat:
46-
path: /tmp/{{ overcloud_host_image_name }}.qcow2
47-
checksum_algorithm: sha256
48-
register: host_image
47+
# - name: Get checksum of file
48+
# ansible.builtin.stat:
49+
# path: /tmp/{{ overcloud_host_image_name }}.qcow2
50+
# checksum_algorithm: sha256
51+
# register: host_image
4952

50-
- name: Write checksum to vars file
51-
ansible.builtin.copy:
52-
content: |
53-
---
54-
# This file is autogenerated by Ansible; DO NOT EDIT!
53+
# - name: Write checksum to vars file
54+
# ansible.builtin.copy:
55+
# content: |
56+
# ---
57+
# # This file is autogenerated by Ansible; DO NOT EDIT!
5558

56-
stackhpc_overcloud_host_image_name: "{{ overcloud_host_image_name }}"
57-
stackhpc_overcloud_host_image_checksum: "{{ host_image.stat.checksum }}"
58-
dest: "{{ kayobe_env_config_path }}/stackhpc-overcloud-host-image.yml"
59-
delegate_to: localhost
60-
run_once: true
59+
# stackhpc_overcloud_host_image_name: "{{ overcloud_host_image_name }}"
60+
# stackhpc_overcloud_host_image_checksum: "{{ host_image.stat.checksum }}"
61+
# dest: "{{ kayobe_env_config_path }}/stackhpc-overcloud-host-image.yml"
62+
# delegate_to: localhost
63+
# run_once: true
6164

62-
- block:
63-
- name: Copy the image to the Ironic volume
64-
ansible.builtin.copy:
65-
src: /tmp/{{ overcloud_host_image_name }}.qcow2
66-
dest: /var/lib/docker/volumes/ironic/_data/{{ overcloud_host_image_name }}.qcow2
67-
remote_src: true
68-
become: true
65+
# - block:
66+
# - name: Copy the image to the Ironic volume
67+
# ansible.builtin.copy:
68+
# src: /tmp/{{ overcloud_host_image_name }}.qcow2
69+
# dest: /var/lib/docker/volumes/ironic/_data/{{ overcloud_host_image_name }}.qcow2
70+
# remote_src: true
71+
# become: true
6972

70-
- name: Make the image available to the Ironic HTTP container
71-
community.docker.docker_container_exec:
72-
container: ironic_http
73-
command: "mv /var/lib/ironic/{{ overcloud_host_image_name }}.qcow2 /var/lib/ironic/httpboot"
74-
become: true
75-
when: overcloud_host_image_ironic | bool
73+
# - name: Make the image available to the Ironic HTTP container
74+
# community.docker.docker_container_exec:
75+
# container: ironic_http
76+
# command: "mv /var/lib/ironic/{{ overcloud_host_image_name }}.qcow2 /var/lib/ironic/httpboot"
77+
# become: true
78+
# when: overcloud_host_image_ironic | bool
7679

7780
- name: Upload an image to Glance
7881
openstack.cloud.image:
7982
name: "{{ overcloud_host_image_name }}"
8083
container_format: bare
8184
disk_format: qcow2
8285
state: present
83-
filename: /tmp/{{ overcloud_host_image_name }}.qcow2
86+
#filename: /tmp/{{ overcloud_host_image_name }}.qcow2
87+
filename: /var/lib/docker/volumes/ironic/_data/{{ overcloud_host_image_name }}.qcow2
8488
run_once: true
8589
environment: "{{ openstack_auth_env }}"
8690
when: overcloud_host_image_glance | bool
91+
become: true

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,33 @@
4747
when:
4848
- bmnode.provision_state not in ["active", "available"]
4949

50+
## flavor creation only seems to show in openstack flavor list when
51+
## is_public: true, deploy server still can't find flavor.
52+
- name: Create flavor for baremetal
53+
openstack.cloud.compute_flavor:
54+
state: present
55+
is_public: false
56+
name: "{{ flavor }}"
57+
ram: "{{ 42 * 1024 }}"
58+
vcpus: 42
59+
disk: 10
60+
ephemeral: 10
61+
extra_specs: "{{ {
62+
('resources:CUSTOM_' ~ ironic_resource_class | upper ): 1,
63+
'resources:VCPU': 0,
64+
'resources:DISK_GB': 0,
65+
'resources:MEMORY_MB': 0
66+
} }}"
67+
# todo: Support mutiple resource classes
68+
run_once: true
69+
70+
- name: Create key pair for baremetal
71+
openstack.cloud.keypair:
72+
state: present
73+
name: "{{ ironic_provision_key_name }}"
74+
# use the key kayobe is using to bootstrap with?
75+
public_key_file: "{{ ssh_public_key_path }}"
76+
5077
- name: Create port
5178
openstack.cloud.port:
5279
state: "{{ 'absent' if force_server_delete else 'present' }}"
@@ -57,6 +84,11 @@
5784
delegate_to: localhost
5885
register: bmport
5986

87+
- name: Set unlimited core quota for project
88+
openstack.cloud.quota:
89+
name: "admin"
90+
cores: -1
91+
6092
# TODO: we should wait till we can reach ssh, via jump host
6193
- name: Deploy Server
6294
openstack.cloud.server:
@@ -65,7 +97,7 @@
6597
nics:
6698
- port-id: "{{ bmport.port.id }}"
6799
image: "{{ image }}"
68-
flavor: "{{ flavor }}"
100+
flavor: "{{ flavor }}"
69101
key_name: "{{ key_name }}"
70102
availability_zone: "::{{ bmnode.id }}"
71103
timeout: 1800 # wait 30 mins for build

etc/kayobe/environments/stackhpc-baremetal/inventory/group_vars/baremetal-redfish/ironic

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@ ironic_redfish_system_id: "/redfish/v1/Systems/1"
1414
ironic_resource_class: "example_resource_class"
1515
ironic_capabilities: "boot_option:local,boot_mode:uefi"
1616
ironic_properties: {}
17-
ironic_network_interface: "flat"
17+
ironic_network_interface: "flat"
18+
# settings for provision-nova.yml
19+
ironic_provision_network: "provision-net"
20+
ironic_provision_flavor: "example_resource_class"
21+
ironic_provision_image: "overcloud-rocky-9-2025.1-20250930T144255"
22+
ironic_provision_key_name: "stack"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#todo
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
- hosts: localhost
3+
gather_facts: false
4+
5+
environment:
6+
VIRTUAL_ENV: "{{ lookup('env', 'VIRTUAL_ENV') }}"
7+
KAYOBE_CONFIG_PATH: "{{ lookup('env', 'KAYOBE_CONFIG_PATH') }}"
8+
9+
tasks:
10+
- name: Run Sushy Emulator playbook
11+
ansible.builtin.shell: |
12+
source "$VIRTUAL_ENV/bin/activate"
13+
kayobe playbook run "$KAYOBE_CONFIG_PATH/environments/stackhpc-sushy-baremetal/ansible/sushy-emulator.yml"
14+
args:
15+
executable: /bin/bash
16+
17+
- name: Run Generate mac addresses playbook
18+
ansible.builtin.shell: |
19+
source "$VIRTUAL_ENV/bin/activate"
20+
kayobe playbook run "$KAYOBE_CONFIG_PATH/environments/stackhpc-sushy-baremetal/ansible/generate-mac-addresses.yml"
21+
args:
22+
executable: /bin/bash
23+
24+
- name: Run Create virtual baremetal playbook
25+
ansible.builtin.shell: |
26+
source "$VIRTUAL_ENV/bin/activate"
27+
kayobe playbook run "$KAYOBE_CONFIG_PATH/environments/stackhpc-sushy-baremetal/ansible/create-virtual-baremetal.yml"
28+
args:
29+
executable: /bin/bash

0 commit comments

Comments
 (0)