Skip to content

Instantly share code, notes, and snippets.

@gfidente
Last active March 9, 2016 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfidente/42d3cdfe0c67f7c95f0c to your computer and use it in GitHub Desktop.
Save gfidente/42d3cdfe0c67f7c95f0c to your computer and use it in GitHub Desktop.
# Instructions:
# 1. save this file somewhere, for example /home/stack/ceph_wipe_disk.yaml
# 2. create an empty ceph_wipe_env.yaml with the following contents:
#
# resource_registry:
# OS::TripleO::NodeUserData: /home/stack/ceph_wipe_disk.yaml
# parameter_defaults:
# ceph_disks: "/dev/sdb /dev/sdc"
#
# 3. when deploying, add to the CLI command the following argument:
#
# -e /path/to/ceph_wipe_env.yaml
heat_template_version: 2014-10-16
parameters:
ceph_disks:
type: string
description: A list of block devices to be cleared with an empty GPT label.
default: "/dev/sdb /dev/sdc"
description: >
This is an example showing how you can clear the cephstorage nodes disk with an empty GPT label on firstboot.
resources:
userdata:
type: OS::Heat::MultipartMime
properties:
parts:
- config: {get_resource: wipe_disk}
wipe_disk:
type: OS::Heat::SoftwareConfig
properties:
config:
str_replace:
template: |
#!/bin/bash
case "$(hostname)" in
*cephstorage*)
for d in $disks; do
if [ -b ${d} ]; then
echo "Wiping disk ${d} ..."
sgdisk -Z ${d}
sgdisk -o ${d}
fi
done
;;
esac
params:
$disks: {get_param: ceph_disks}
outputs:
OS::stack_id:
value: {get_resource: userdata}
@gfidente
Copy link
Author

gfidente commented Dec 2, 2015

hi, I think best option to make sure this is applied only on the relevant nodes is to add role-specific NodeUserData in the parent templates, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment