# Revision history [back]

If you want to accomplish something similar using HOT templates, take a look at this template, which gathers a list of "minion" nodes and includes them in a configuration file on the master.

In general, to do this sort of thing you use the str_replace function inside the user_data property of your server. The str_replace function looks like this:

str_replace:
template: "...template text..."
params:
param1: value1
param2: value2


For anything more than a single line, you'll use YAML's | operator to insert literal text, like this:

str_replace:
template: |
#!/bin/sh

echo param1 > some_file
echo param2 > another_file
params:
param1: value1
param2: value2


The values in the params dictionary can be set using the same functions you use in the outputs section of your template. For example:

user_data:
str_replace:
template: |
#!/bin/sh

echo SERVER_IP > some_file
params:
SERVER_IP: {get_attr: [my_server_eth0, fixed_ips, 0, ip_address]}