Chapter 10. Creating Custom Configuration
In some cases, you might want to provide configuration for additional applications that integrate with your Red Hat Enterprise Linux OpenStack Platform environment. This custom configuration requires additional Heat templates included with your Overcloud stack. This section examines some of the custom configuration operations available to you.
10.1. Customizing Configuration on First Boot
The director provides a mechanism to perform configuration on all nodes upon the initial creation of the Overcloud. The director achieves this through
cloud-init
, which you can call using the OS::TripleO::NodeUserData
resource type.
In this example, In this example, we aim to update the nameserver with a custom IP address on all nodes. We first create a basic Heat template (
/home/stack/templates/nameserver.yaml
) that runs a script to append each node's resolv.conf
with a specific nameserver. We use the OS::TripleO::MultipartMime
resource type to send the configuration script.
heat_template_version: 2014-10-16 description: > Extra hostname configuration resources: userdata: type: OS::Heat::MultipartMime properties: parts: - config: {get_resource: nameserver_config} nameserver_config: type: OS::Heat::SoftwareConfig properties: config: | #!/bin/bash echo "nameserver 192.168.1.1" >> /etc/resolv.conf outputs: OS::stack_id: value: {get_resource: userdata}
Next, create an environment file (
/home/stack/templates/firstboot.yaml
) that registers our Heat template as the OS::TripleO::NodeUserData
resource type.
resource_registry: OS::TripleO::NodeUserData: /home/stack/templates/nameserver.yaml
To add the first boot configuration, add the environment file to the stack when first creating the Overcloud. For example:
$ openstack overcloud deploy --templates -e /home/stack/templates/firstboot.yaml
The
-e
applies the environment file to the Overcloud stack.
This adds the configuration to all nodes when they are first created and boot for the first time. Subsequent inclusions of these templates, such as updating the Overcloud stack, does not run these scripts.
Important
You can only register the
OS::TripleO::NodeUserData
to only one Heat template. Subsequent usage overrides the Heat template to use.