-
Notifications
You must be signed in to change notification settings - Fork 6
/
ironic-node-enroll.yml
51 lines (46 loc) · 2.3 KB
/
ironic-node-enroll.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This playbook will require the following variables
# utility_address: This is the IP address of a utility node
# deploy_ramdisk: This is the ramdisk image name created with DIB as found in glance
# deploy_kernel: This is the kernel image name created with DIB as found in glance
# ironic_deploy_image_name: Name of the user image assosiated with a given node
- name: Setup the utility location(s)
hosts: ilo-ironic-nodes
user: root
gather_facts: false
tasks:
- name: create ironic nodes
shell: |
. ~/openrc
KERNEL_IMAGE=$(glance image-list | awk '/ubuntu-user-image.vmlinuz/ {print $2}')
INITRAMFS_IMAGE=$(glance image-list | awk '/ubuntu-user-image.initrd/ {print $2}')
DEPLOY_RAMDISK=$(glance image-list | awk '/ironic-deploy.initramfs/ {print $2}')
DEPLOY_KERNEL=$(glance image-list | awk '/ironic-deploy.kernel/ {print $2}')
if ironic node-list | grep "{{ inventory_hostname }}"; then
NODE_UUID=$(ironic node-list | awk '/{{ inventory_hostname }}/ {print $2}')
else
NODE_UUID=$(ironic node-create \
-d agent_ipmitool \
-i ipmi_address="{{ ilo_address }}" \
-i ipmi_password="{{ ilo_password }}" \
-i ipmi_username="{{ ilo_user }}" \
-i deploy_ramdisk="${DEPLOY_RAMDISK}" \
-i deploy_kernel="${DEPLOY_KERNEL}" \
-n {{ inventory_hostname }} | awk '/ uuid / {print $4}')
ironic port-create -n "$NODE_UUID" \
-a {{ Port1NIC_MACAddress }}
fi
ironic node-update "$NODE_UUID" add \
driver_info/deploy_kernel=$DEPLOY_KERNEL \
driver_info/deploy_ramdisk=$DEPLOY_RAMDISK \
instance_info/deploy_kernel=$KERNEL_IMAGE \
instance_info/deploy_ramdisk=$INITRAMFS_IMAGE \
instance_info/root_gb=40 \
properties/cpus=48 \
properties/memory_mb=254802 \
properties/local_gb=80 \
properties/size=3600 \
properties/cpu_arch=x86_64 \
properties/capabilities=memory_mb:254802,local_gb:80,cpu_arch:x86_64,cpus:48,boot_option:local
delegate_to: "{{ utility_address }}"
tags:
- ironic-create