heat_template_version: 2015-10-15

description: Configure hieradata for Cinder Dell Storage Center configuration

parameters:
  server:
    description: ID of the controller node to apply this config to
    type: string

  # Config specific parameters, to be provided via parameter_defaults
  CinderEnableDellScBackend:
    type: boolean
    default: true
  CinderDellScBackendName:
    type: string
    default: 'tripleo_dellsc'
  CinderDellScSanIp:
    type: string
  CinderDellScSanLogin:
    type: string
    default: 'Admin'
  CinderDellScSanPassword:
    type: string
    hidden: true
  CinderDellScSsn:
    type: string
    default: '64702'
  CinderDellScIscsiIpAddress:
    type: string
    default: ''
  CinderDellScIscsiPort:
    type: string
    default: '3260'
  CinderDellScApiPort:
    type: string
    default: '3033'
  CinderDellScServerFolder:
    type: string
    default: 'dellsc_server'
  CinderDellScVolumeFolder:
    type: string
    default: 'dellsc_volume'

resources:
  CinderDellScConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        hiera:
          datafiles:
            cinder_dellsc_data:
              mapped_data:
                tripleo::profile::base::cinder::volume::cinder_enable_dellsc_backend: {get_input: EnableDellScBackend}
                cinder::backend::dellsc_iscsi::volume_backend_name: {get_input: DellScBackendName}
                cinder::backend::dellsc_iscsi::san_ip: {get_input: DellScSanIp}
                cinder::backend::dellsc_iscsi::san_login: {get_input: DellScSanLogin}
                cinder::backend::dellsc_iscsi::san_password: {get_input: DellScSanPassword}
                cinder::backend::dellsc_iscsi::dell_sc_ssn: {get_input: DellScSsn}
                cinder::backend::dellsc_iscsi::iscsi_ip_address: {get_input: DellScIscsiIpAddress}
                cinder::backend::dellsc_iscsi::iscsi_port: {get_input: DellScIscsiPort}
                cinder::backend::dellsc_iscsi::dell_sc_api_port: {get_input: DellScApiPort}
                cinder::backend::dellsc_iscsi::dell_sc_server_folder: {get_input: DellScServerFolder}
                cinder::backend::dellsc_iscsi::dell_sc_volume_folder: {get_input: DellScVolumeFolder}

  CinderDellScDeployment:
    type: OS::Heat::StructuredDeployment
    properties:
      config: {get_resource: CinderDellScConfig}
      server: {get_param: server}
      input_values:
        EnableDellScBackend: {get_param: CinderEnableDellScBackend}
        DellScBackendName: {get_param: CinderDellScBackendName}
        DellScSanIp: {get_param: CinderDellScSanIp}
        DellScSanLogin: {get_param: CinderDellScSanLogin}
        DellScSanPassword: {get_param: CinderDellScSanPassword}
        DellScSsn: {get_param: CinderDellScSsn}
        DellScIscsiIpAddress: {get_param: CinderDellScIscsiIpAddress}
        DellScIscsiPort: {get_param: CinderDellScIscsiPort}
        DellScApiPort: {get_param: CinderDellScApiPort}
        DellScServerFolder: {get_param: CinderDellScServerFolder}
        DellScVolumeFolder: {get_param: CinderDellScVolumeFolder}

outputs:
  deploy_stdout:
    description: Deployment reference, used to trigger puppet apply on changes
    value: {get_attr: [CinderDellScDeployment, deploy_stdout]}
