Ask Your Question
0

multiple templates in user_data of heat template

asked 2018-08-18 12:57:09 -0500

br gravatar image
resources:   my_instance:
type: OS::Nova::Server
properties:
  # general properties ...
  user_data:
    str_replace:
      template: |
        #!/bin/bash
        echo "Hello world"
        echo "Setting MySQL root password"
        mysqladmin -u root password $db_rootpassword
        # do more things ...
      params:
        $db_rootpassword: { get_param: DBRootPassword }

I want to append another shell script (setup.sh) in user data as follows:

user_data:
str_replace:
  **template**: |
    #!/bin/bash
    echo "Hello world"
    echo "Setting MySQL root password"
    mysqladmin -u root password $db_rootpassword
    # do more things ...
  **template**: {get_file: 'setup.sh'}

Is it allowed to define two template definitions in user_data as above. If not please suggest.

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2018-08-18 17:25:32 -0500

Use MIME multi-part archives. That’s the cloud-init method for handling more than one script. Heat has a corresponding resource type, OS::Heat::MultipartMime, but you can also use it in the user_data property,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2018-08-18 12:57:09 -0500

Seen: 85 times

Last updated: Aug 18 '18