summaryrefslogtreecommitdiffstats
path: root/puppet/ceph-storage-puppet.yaml
blob: 660ea30acf93b64213cc5737fe768e413a12ffd2 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
heat_template_version: 2014-10-16
description: 'OpenStack ceph storage node configured by Puppet'
parameters:
  Flavor:
    description: Flavor for the Ceph Storage node.
    type: string
    constraints:
      - custom_constraint: nova.flavor
  Image:
    type: string
    default: overcloud-ceph-storage
    constraints:
      - custom_constraint: glance.image
  ImageUpdatePolicy:
    default: 'REBUILD_PRESERVE_EPHEMERAL'
    description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt.
    type: string
  KeyName:
    description: Name of an existing EC2 KeyPair to enable SSH access to the instances
    type: string
    default: default
    constraints:
      - custom_constraint: nova.keypair
  NtpServer:
    type: string
    default: ''
  EnablePackageInstall:
    default: 'false'
    description: Set to true to enable package installation via Puppet
    type: boolean

resources:
  CephStorage:
    type: OS::Nova::Server
    properties:
      image: {get_param: Image}
      image_update_policy: {get_param: ImageUpdatePolicy}
      flavor: {get_param: Flavor}
      key_name: {get_param: KeyName}
      networks:
        - network: ctlplane
      user_data_format: SOFTWARE_CONFIG
      user_data: {get_resource: NodeUserData}

  NodeUserData:
    type: OS::TripleO::NodeUserData

  NetworkConfig:
    type: OS::TripleO::CephStorage::Net::SoftwareConfig

  NetworkDeployment:
    type: OS::TripleO::SoftwareDeployment
    properties:
      config: {get_attr: [NetworkConfig, config_id]}
      server: {get_resource: CephStorage}

  CephStorageDeployment:
    type: OS::Heat::StructuredDeployment
    properties:
      config: {get_resource: CephStorageConfig}
      server: {get_resource: CephStorage}
      input_values:
        ntp_servers:
          str_replace:
            template: '["server"]'
            params:
              server: {get_param: NtpServer}
        enable_package_install: {get_param: EnablePackageInstall}

  CephStorageConfig:
    type: OS::Heat::StructuredConfig
    properties:
      group: os-apply-config
      config:
        hiera:
          hierarchy:
            - heat_config_%{::deploy_config_name}
            - cephstorage
            - ceph_cluster # provided by CephClusterConfig
            - ceph
            - '"%{::osfamily}"'
            - common
          datafiles:
            common:
              raw_data: {get_file: hieradata/common.yaml}
            ceph:
              raw_data: {get_file: hieradata/ceph.yaml}
            cephstorage:
              mapped_data:
                ntp::servers: {get_input: ntp_servers}
                enable_package_install: {get_input: enable_package_install}

outputs:
  hosts_entry:
    value:
      str_replace:
        template: "IP HOST HOST.novalocal"
        params:
          IP: {get_attr: [CephStorage, networks, ctlplane, 0]}
          HOST: {get_attr: [CephStorage, name]}
  nova_server_resource:
    description: Heat resource handle for the ceph storage server
    value:
      {get_resource: CephStorage}