Skip to content

Instantly share code, notes, and snippets.

@pratikmallya
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pratikmallya/ca6ba8685a816c8e6db8 to your computer and use it in GitHub Desktop.
Save pratikmallya/ca6ba8685a816c8e6db8 to your computer and use it in GitHub Desktop.
heat_template_version: 2014-10-16
description: |
A template which demonstrates doing boot-time installation of the required
files for script based software deployments.
This template expects to be created with an environment which defines
the resource type Heat::InstallConfigAgent such as
../boot-config/fedora_pip_env.yaml
resources:
config:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: foo
- name: bar
outputs:
- name: result
config: |
#!/bin/sh -x
echo "Writing to /tmp/$bar"
echo $foo > /tmp/$bar
echo -n "The file /tmp/$bar contains `cat /tmp/$bar` for server $deploy_server_id during $deploy_action" > $heat_outputs_path.result
echo "Written to /tmp/$bar"
echo "Output to stderr" 1>&2
deployment:
type: OS::Heat::SoftwareDeployment
properties:
signal_transport: TEMP_URL_SIGNAL
config:
get_resource: config
server:
get_resource: server
input_values:
foo: fooooo
bar: baaaaa
boot_config:
type: Heat::InstallConfigAgent
ssh_key:
type: OS::Nova::KeyPair
properties:
name: private_access_key
save_private_key: true
server:
type: OS::Nova::Server
properties:
image: 6f29d6a6-9972-4ae0-aa80-040fa2d6a9cf # Ubuntu Ubuntu 14.04
flavor: 2 GB Performance
key_name: { get_resource: ssh_key }
software_config_transport: POLL_TEMP_URL
user_data_format: SOFTWARE_CONFIG
user_data: {get_attr: [boot_config, config]}
outputs:
result:
value:
get_attr: [deployment, result]
stdout:
value:
get_attr: [deployment, deploy_stdout]
stderr:
value:
get_attr: [deployment, deploy_stderr]
status_code:
value:
get_attr: [deployment, deploy_status_code]
server_ip:
value:
get_attr: [server, accessIPv4]
private_key:
value:
get_attr: [ssh_key, private_key]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment