1 heat_template_version: pike
3 # NOTE: You don't need to pass the parameter explicitly from the
4 # parent template, it can be specified via the parameter_defaults
5 # in the resource_registry instead, if you want to override the default
6 # and/or share values with other templates in the tree.
13 This is an example showing how you can do firstboot configuration
14 of the nodes via cloud-init. To enable this, replace the default
15 mapping of OS::TripleO::NodeUserData in ../overcloud_resource_registry*
19 type: OS::Heat::MultipartMime
22 - config: {get_resource: user_config}
23 - config: {get_resource: ssh_config}
25 # Get cloud-init to create an extra user, in addition to the default for the
26 # distro. Note there are various options, including configuring ssh keys,
27 # but atm I can only see how to specify the keys explicitly, not via metadata
29 type: OS::Heat::CloudConfig
34 - name: {get_param: extra_username}
36 # Setup ssh key for the extra user to match the key installed for the default
37 # user, e.g that provided via the nova keypair on instance boot
39 type: OS::Heat::SoftwareConfig
45 curl http://169.254.169.254/openstack/2012-08-10/meta_data.json -o /root/meta_data.json
46 mkdir -p /home/$user/.ssh
47 chmod 700 /home/$user/.ssh
48 cat /root/meta_data.json | jq -r ".keys[0].data" > /home/$user/.ssh/authorized_keys
49 chmod 600 /home/$user/.ssh/authorized_keys
50 chown -R $user:$user /home/$user/.ssh
52 $user: {get_param: extra_username}
55 # This means get_resource from the parent template will get the userdata, see:
56 # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent
57 # Note this is new-for-kilo, an alternative is returning a value then using
58 # get_attr in the parent template instead.
60 value: {get_resource: userdata}