How to use local files as a parameter to a heat template? or just paste them in? [closed]

asked 2017-07-25 09:55:02 -0500

d0moarigatomrrob0to0o0o gravatar image

I have been using the following template as a proof of concept for an openstack project and would like to use local files in (or just paste their contents into) the heat template but the get_file syntax demands I do it through a URL whenever I try to launch the stack.

Are their any ways to get the 2 files called in the template from the local machine running using horizon/openstack controller or to just paste the contents of ActiveDirectoryDomainController.ps1 and AD.psm1 into the template instead of calling a file from the GitHub website?

original: ( https://github.com/openstack/heat-templates/blob/master/hot/Windows/ActiveDirectoryController/ActiveDirectoryDomainController.yaml (https://github.com/openstack/heat-tem...) )

What actually works:

heat_template_version: '2013-05-23'
parameters:
  ad_max_timeout: {default: 3600, description: 'The maximum allowed time for the ad
      instalation to finish.

      ', type: number}
  domain_name:
    constraints:
    - length: {max: 256, min: 3}
    - {allowed_pattern: '[A-Za-z0-9]+(?=[\.\-][a-zA-Z0-9])*\.[a-zA-z09]+', description: must
        be a valid DNS name.}
    default: cloudbase.local
    description: The domain name
    type: string
  domain_netbios_name:
    constraints:
    - length: {max: 15, min: 1}
    - {allowed_pattern: '[a-zA-Z][a-zA-Z0-9]*', description: must begin with a letter
        and contain only alphanumeric characters.}
    default: cloudbase
    description: The Netbios domain name
    type: string
  flavor: {default: m1.small, description: Id or name of an existing flavor, type: string}
  image: {default: Windows Server 2012 R2 Std Eval, description: Id or name of an
      existing Windows image, type: string}
  key_name: {description: Name of an existing keypair to encrypt the Admin password,
    type: string}
  network: {description: Id or name of an existing network, type: string}
  safe_mode_administrator_password:
    constraints:
    - length: {max: 64, min: 8}
    - {allowed_pattern: '(?=^.{6,255}$)((?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*',
      description: must contain letters numbers and symbols}
    description: The safe mode administration password
    hidden: true
    type: string
resources:
  ad_init:
    depends_on: ad_wait_condition_handle
    properties:
      parts:
      - config: {get_resource: ad_module}
        filename: AD.psm1
        subtype: x-cfninitdata
      - config: {get_resource: dc_init}
        filename: cfn-userdata
        subtype: x-cfninitdata
    type: OS::Heat::MultipartMime
  ad_module:
    properties:
      *config: {get_file: 'https://raw.githubusercontent.com/openstack/heat-templates/master/hot/Windows/ActiveDirectoryController/AD.psm1'}*
      group: ungrouped
    type: OS::Heat::SoftwareConfig
  ad_wait_condition:
    depends_on: ad_wait_condition_handle
    properties:
      count: 1
      handle: {get_resource: ad_wait_condition_handle}
      timeout: {get_param: ad_max_timeout}
    type: OS::Heat::WaitCondition
  ad_wait_condition_handle: {type: 'OS::Heat::WaitConditionHandle'}
  dc:
    properties:
      flavor: {get_param: flavor}
      image: {get_param: image}
      key_name: {get_param: key_name}
      networks:
      - network: {get_param: network}
      user_data: {get_resource: ad_init}
      user_data_format: RAW
    type: OS::Nova::Server
  dc_init:
    properties:
      config:
        str_replace:
          params:
            ad_wait_condition_endpoint:
              get_attr: [ad_wait_condition_handle, endpoint]
            ad_wait_condition_token:
              get_attr: [ad_wait_condition_handle, token]
            domain_name: {get_param: domain_name}
            domain_netbios_name: {get_param: domain_netbios_name}
            safe_mode_administrator_password: {get_param: safe_mode_administrator_password}
          template: {get_file: 'https://raw.githubusercontent.com/openstack/heat-templates/master/hot/Windows/ActiveDirectoryController/ActiveDirectoryDomainController.ps1'}
      group: ungrouped
    type: OS::Heat::SoftwareConfig
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by zaneb
close date 2017-07-28 16:28:43.412044