heat_template_version: rocky

description: >
  Post-deployment for the TripleO standalone deployment

parameters:
  servers:
    type: json
  DeployedServerPortMap:
    default: {}
    type: json
  StandaloneHomeDir:
    description: The HOME directory where the stackrc and ssh credentials for the Standalone will be installed. Set to /home/<user> to customize the location.
    type: string
    default: '/root'
  AdminPassword: #supplied by tripleo-undercloud-passwords.yaml
    type: string
    description: The password for the keystone admin account, used for monitoring, querying neutron etc.
    hidden: True
  KeystoneRegion:
    type: string
    default: 'regionOne'
    description: Keystone region for endpoint
  StandaloneCloudName:
    type: string
    default: 'standalone'
    description: Cloud name for the clouds.yaml
  PythonInterpreter:
    type: string
    description: The python interpreter to use for python and ansible actions
    default: /usr/bin/python
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json

resources:

  CloudsYamlConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      inputs:
        - name: admin_password
        - name: auth_url
        - name: cloud_name
        - name: home_dir
        - name: identity_api_version
        - name: project_name
        - name: project_domain_name
        - name: region_name
        - name: user_name
        - name: user_domain_name
      config: {get_file: ./clouds_yaml.py}

  CloudsYamlDeployment:
    type: OS::Heat::SoftwareDeploymentGroup
    properties:
      name: CloudsYamlDeployment
      servers: {get_param: servers}
      config: {get_resource: CloudsYamlConfig}
      input_values:
        admin_password: {get_param: AdminPassword}
        auth_url: {get_param: [EndpointMap, KeystonePublic, uri_no_suffix]}
        cloud_name: {get_param: StandaloneCloudName}
        home_dir: {get_param: StandaloneHomeDir}
        identity_api_version: 3
        project_name: 'admin'
        project_domain_name: 'Default'
        region_name: {get_param: KeystoneRegion}
        user_name: 'admin'
        user_domain_name: 'Default'
