heat_template_version: 2015-10-15

description: Configure hieradata for Cinder Eqlx 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
  CinderEnableEqlxBackend:
    type: boolean
    default: true
  CinderEqlxBackendName:
    type: string
    default: 'tripleo_eqlx'
  CinderEqlxSanIp:
    type: string
  CinderEqlxSanLogin:
    type: string
  CinderEqlxSanPassword:
    type: string
    hidden: true
  CinderEqlxSanThinProvision:
    type: boolean
    default: true
  CinderEqlxGroupname:
    type: string
    default: 'group-0'
  CinderEqlxPool:
    type: string
    default: 'default'
  CinderEqlxChapLogin:
    type: string
    default: ''
  CinderEqlxChapPassword:
    type: string
    default: ''
  CinderEqlxUseChap:
    type: boolean
    default: false

resources:
  CinderEqlxConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        hiera:
          datafiles:
            cinder_eqlx_data:
              mapped_data:
                tripleo::profile::base::cinder::volume::cinder_enable_eqlx_backend: {get_input: EnableEqlxBackend}
                cinder::backend::eqlx::volume_backend_name: {get_input: EqlxBackendName}
                cinder::backend::eqlx::san_ip: {get_input: EqlxSanIp}
                cinder::backend::eqlx::san_login: {get_input: EqlxSanLogin}
                cinder::backend::eqlx::san_password: {get_input: EqlxSanPassword}
                cinder::backend::eqlx::san_thin_provision: {get_input: EqlxSanThinProvision}
                cinder::backend::eqlx::eqlx_group_name: {get_input: EqlxGroupname}
                cinder::backend::eqlx::eqlx_pool: {get_input: EqlxPool}
                cinder::backend::eqlx::eqlx_use_chap: {get_input: EqlxUseChap}
                cinder::backend::eqlx::eqlx_chap_login: {get_input: EqlxChapLogin}
                cinder::backend::eqlx::eqlx_chap_password: {get_input: EqlxChapPassword}

  CinderEqlxDeployment:
    type: OS::Heat::StructuredDeployment
    properties:
      config: {get_resource: CinderEqlxConfig}
      server: {get_param: server}
      input_values:
        EnableEqlxBackend: {get_param: CinderEnableEqlxBackend}
        EqlxBackendName: {get_param: CinderEqlxBackendName}
        EqlxSanIp: {get_param: CinderEqlxSanIp}
        EqlxSanLogin: {get_param: CinderEqlxSanLogin}
        EqlxSanPassword: {get_param: CinderEqlxSanPassword}
        EqlxSanThinProvision: {get_param: CinderEqlxSanThinProvision}
        EqlxGroupname: {get_param: CinderEqlxGroupname}
        EqlxPool: {get_param: CinderEqlxPool}
        EqlxUseChap: {get_param: CinderEqlxUseChap}
        EqlxChapLogin: {get_param: CinderEqlxChapLogin}
        EqlxChapPassword: {get_param: CinderEqlxChapPassword}

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