get_file in cloud_config runcmd [closed]

asked 2017-04-04 04:25:41 -0500

AB239 gravatar image

Hello,

I want to know if we can use get_file to fetch a file with cloud_config's runcmd command?

For example, can this:

  run_cloud_config:
    type: OS::Heat::CloudConfig
    properties:
      cloud_config:
        runcmd:
        - sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
        - sed -i -e '$aPasswordAuthentication yes' /etc/ssh/sshd_config
        - restart ssh

be written as or something similar so that I could fetch the set of command from external source rather than keeping them in template:

  run_cloud_config:
    type: OS::Heat::CloudConfig
    properties:
      cloud_config:
        runcmd:
        - content: {get_file: <path to file>}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by AB239
close date 2020-03-05 00:04:29.341933

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-09-05 18:23:00 -0500

I tried the following:

base_config:
type: OS::Heat::CloudConfig
properties:
  cloud_config:
    runcmd: { get_file: <path/to/file> }

That did not work. Looking at the cloud-init logs, seems like the way the data is passed in, runcmd was trying to run each character of the file one at a time.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-04-04 04:25:41 -0500

Seen: 197 times

Last updated: Apr 04 '17