aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/all_nodes/contrail/enable_contrail_repo.yaml
blob: 51da6f6536e699df7333bde74fa5073ee35e3bf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
heat_template_version: pike

parameters:
  ContrailRepo:
    type: string
    default: ''

resources:
  userdata:
    type: OS::Heat::MultipartMime
    properties:
      parts:
      - config: {get_resource: EnableContrailRepoConfig}

  EnableContrailRepoConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      config:
        str_replace:
          template: |
            #!/bin/bash
            contrail_repo=$contrail_repo
            if [[ ${contrail_repo} ]]; then
               cat <<EOF > /etc/yum.repos.d/contrail.repo
            [Contrail]
            name=Contrail Repo
            baseurl=${contrail_repo}
            enabled=1
            gpgcheck=0
            protect=1
            metadata_expire=30
            EOF
            fi
          params:
            $contrail_repo: {get_param: ContrailRepo}

outputs:
  # This means get_resource from the parent template will get the userdata, see:
  # http://docs.openstack.org/developer/heat/template_guide/composition.html#making-your-template-resource-more-transparent
  # Note this is new-for-kilo, an alternative is returning a value then using
  # get_attr in the parent template instead.
  OS::stack_id:
    value: {get_resource: userdata}