Skip to content

Instantly share code, notes, and snippets.

@chriscowley
Created May 15, 2015 09:50
Show Gist options
  • Select an option

  • Save chriscowley/f22d1ca4729d65824687 to your computer and use it in GitHub Desktop.

Select an option

Save chriscowley/f22d1ca4729d65824687 to your computer and use it in GitHub Desktop.
Create cinder volume and an instance, format and mount the volume
jenkins:
type: OS::Nova::Server
properties:
image: { get_param: ImageID }
flavor: m1.tiny
networks:
- network: { get_param: NetID }
user_data_format: RAW
user_data:
str_replace:
template: |
#cloud-config
write_files:
- content: |
#!/bin/bash
voldata_id="%voldata_id%"
voldata_dev="/dev/disk/by-id/virtio-$(echo ${voldata_id} | cut -c -20)"
mkfs.ext4 ${voldata_dev}
mkdir -pv /var/lib/jenkins
echo "${voldata_dev} /var/lib/jenkins ext4 defaults 1 2" >> /etc/fstab
mount /var/lib/jenkins
path: /tmp/format-disks
permissions: '0700'
runcmd:
- /tmp/format-disks
params:
"%voldata_id%": { get_resource: jenkins_data }
jenkins_data:
type: OS::Cinder::Volume
properties:
size: 50
jenkins_data_att:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: { get_resource: jenkins }
volume_id: { get_resource: jenkins_data}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment