File: elastic.pp

package info (click to toggle)
openstack-cluster-installer 43.0.18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,484 kB
  • sloc: php: 19,127; sh: 18,142; ruby: 75; makefile: 31; xml: 8
file content (179 lines) | stat: -rw-r--r-- 4,700 bytes parent folder | download | duplicates (2)
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
class oci::elastic(
  $machine_hostname         = undef,
  $machine_ip               = undef,
  $self_signed_api_cert     = true,

  $elastic_repo_url         = 'https://artifacts.elastic.co/packages',
  $elastic_version          = 7,
  $elastic_key_url          = 'https://artifacts.elastic.co/GPG-KEY-elasticsearch',
  $elastic_key_id           = '46095ACC8548582C1A2699A9D27D666CD88E42B4',

  $pass_cloudkitty_elastic  = undef,
  $pass_elastic_keystore    = undef,

  # From variables.json
  $kernel_from_backports    = false,
){

  class { '::oci::puppet_oci_ca_cert':
    self_signed_api_cert => $self_signed_api_cert,
  }

  include ::java
  class { '::elastic_stack::repo':
    version       => $elastic_version,
    base_repo_url => $elastic_repo_url,
    repo_key_url  => $elastic_key_url,
    repo_key_id   => $elastic_key_id,
  }
  class { '::elasticsearch':
    ssl            => true,
    ca_certificate => '/etc/ssl/certs/oci-pki-oci-ca-chain.pem',
    certificate    => '/etc/ssl/certs/ssl-cert-snakeoil.pem',
    private_key    => '/etc/ssl/private/ssl-cert-snakeoil.key',
    keystore_password => $pass_elastic_keystore,
    config => {
      'network.bind_host'    => '0.0.0.0',
      'discovery.seed_hosts' => $machine_hostname,
      'discovery.type'       => 'single-node',
    }
  }
  -> ::elasticsearch::user { 'cloudkitty':
    password => $pass_cloudkitty_elastic,
    roles    => ['superuser'],
  }
  -> exec { 'create-cloudkitty-template':
    command => join(['/usr/bin/curl -XPOST "https://', $machine_hostname, ':9200/_template/cloudkitty" -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d \'{
  "index_patterns": ["*"],
  "settings": {
    "index": {
      "number_of_shards": "1",
      "number_of_replicas": "1"
    }
  },
  "mappings": {
    "properties": {
      "end": {
        "type": "date",
        "ignore_malformed": true
      },
      "groupby": {
        "dynamic": "true",
        "properties": {
          "id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "project_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "user_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      },
      "metadata": {
        "dynamic": "true",
        "properties": {
          "container_format": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "disk_format": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "flavor_id": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "flavor_name": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "vcpus": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          },
          "volume_type": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword",
                "ignore_above": 256
              }
            }
          }
        }
      },
      "price": {
        "type": "double",
        "ignore_malformed": true
      },
      "qty": {
        "type": "double",
        "ignore_malformed": true
      },
      "start": {
        "type": "date",
        "ignore_malformed": true
      },
      "type": {
        "type": "keyword"
      },
      "unit": {
        "type": "keyword"
      }
    }
  },
  "aliases": {}
}\''], '')
  }
  -> exec { 'create-cloudkitty-index':
    command => join(['/usr/bin/curl -XPUT https://', $machine_hostname, ':9200/cloudkitty/_bulk -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d\'{ "create": {} }
{ "@timestamp": "2099-05-06T16:21:15.000Z" }
\''], ''),
  }
}