c9991c2e31
With I57047682cfa82ba6ca4affff54fab5216e9ba51c Heat has added a new template version for wallaby. This would allow us to use 2-argument variant of the ``if`` function that would allow for e.g. conditional definition of resource properties and help cleanup templates. If only two arguments are passed to ``if`` function, the entire enclosing item is removed when the condition is false. Change-Id: I25f981b60c6a66b39919adc38c02a051b6c51269
65 lines
2.5 KiB
YAML
65 lines
2.5 KiB
YAML
heat_template_version: wallaby
|
|
|
|
parameters:
|
|
servers:
|
|
type: json
|
|
EndpointMap:
|
|
default: {}
|
|
description: Mapping of service endpoint -> protocol. Typically set
|
|
via parameter_defaults in the resource registry.
|
|
type: json
|
|
|
|
resources:
|
|
|
|
ExtraConfig:
|
|
type: OS::Heat::SoftwareConfig
|
|
properties:
|
|
group: script
|
|
config: |
|
|
#!/bin/bash
|
|
set -e
|
|
dnf install -y python3-virtualbmc libvirt-client libvirt-daemon libvirt qemu-kvm
|
|
systemctl start libvirtd virtualbmc
|
|
git clone https://opendev.org/openstack/ironic /tmp/ironic
|
|
mkdir -p /var/log/bmlogs
|
|
chmod 777 /var/log/bmlogs
|
|
|
|
# Create a ssh keypair and place the private key somewhere ansible inside the
|
|
# neutron_api container can read it.
|
|
ssh-keygen -P "" -f /etc/puppet/ci-key
|
|
chmod 644 /etc/puppet/ci-key
|
|
cat /etc/puppet/ci-key.pub >> /root/.ssh/authorized_keys
|
|
|
|
LIBVIRT_STORAGE_POOL=${LIBVIRT_STORAGE_POOL:-"default"}
|
|
LIBVIRT_STORAGE_POOL_PATH=${LIBVIRT_STORAGE_POOL_PATH:-/var/lib/libvirt/images}
|
|
|
|
mkdir -p $LIBVIRT_STORAGE_POOL_PATH
|
|
|
|
if ! virsh pool-list --all | grep -q $LIBVIRT_STORAGE_POOL; then
|
|
virsh pool-define-as --name $LIBVIRT_STORAGE_POOL dir --target $LIBVIRT_STORAGE_POOL_PATH
|
|
virsh pool-autostart $LIBVIRT_STORAGE_POOL
|
|
virsh pool-start $LIBVIRT_STORAGE_POOL
|
|
fi
|
|
|
|
pool_state=$(virsh pool-info $LIBVIRT_STORAGE_POOL | grep State | awk '{ print $2 }')
|
|
if [ "$pool_state" != "running" ] ; then
|
|
virsh pool-start $LIBVIRT_STORAGE_POOL
|
|
fi
|
|
|
|
/tmp/ironic/devstack/tools/ironic/scripts/create-node.sh -n node1 -c 1 -m 3072 -d 10 -b br-ex -p 1161 -M 1350 -f qcow2 -a x86_64 -E qemu -l /var/log/bmlogs -A 66:0d:1d:d8:0b:11 > /var/log/bmlogs/create-node-1.log 2>&1 < /dev/null
|
|
/tmp/ironic/devstack/tools/ironic/scripts/create-node.sh -n node2 -c 1 -m 3072 -d 10 -b br-ex -p 1162 -M 1350 -f qcow2 -a x86_64 -E qemu -l /var/log/bmlogs -A 66:0d:1d:d8:0b:22 > /var/log/bmlogs/create-node-2.log 2>&1 < /dev/null
|
|
|
|
vbmc --no-daemon add node1 --port 1161
|
|
vbmc --no-daemon start node1
|
|
vbmc --no-daemon add node2 --port 1162
|
|
vbmc --no-daemon start node2
|
|
|
|
disown -a
|
|
ExtraDeployments:
|
|
type: OS::Heat::SoftwareDeploymentGroup
|
|
properties:
|
|
servers: {get_param: servers}
|
|
config: {get_resource: ExtraConfig}
|
|
actions: ['CREATE'] # Only do this on CREATE
|
|
name: VirtNodeExtraConfig
|