Puppet Class: profile::presto::client

Defined in:
modules/profile/manifests/presto/client.pp

Overview

Class profile::presto::client

Installs presto-cli and configures it to contact the Presto service at $discovery_uri

Parameters

discovery_uri

URI to Presto discovery server. This is likely the same as the coordinator port.

presto_clusters_secrets

Hash of available/configured Presto clusters and their secret properties, like passwords, etc.. The following values will be checked in the hash table only if TLS/Kerberos configs are enabled (see in the code for the exact values).

- 'ssl_keystore_password'
- 'ssl_trustore_password'

Default: {}

Parameters:

  • cluster_name (String) (defaults to: hiera('profile::presto::cluster_name'))
  • discovery_uri (String) (defaults to: hiera('profile::presto::discovery_uri'))
  • use_kerberos (Boolean) (defaults to: hiera('profile::presto::use_kerberos', false))
  • presto_clusters_secrets (Optional[Hash[String, Hash[String, String]]]) (defaults to: hiera('presto_clusters_secrets', {}))


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
# File 'modules/profile/manifests/presto/client.pp', line 18

class profile::presto::client(
    String $cluster_name = hiera('profile::presto::cluster_name'),
    String $discovery_uri = hiera('profile::presto::discovery_uri'),
    Boolean $use_kerberos = hiera('profile::presto::use_kerberos', false),
    Optional[Hash[String, Hash[String, String]]] $presto_clusters_secrets = hiera('presto_clusters_secrets', {}),
) {

    if $presto_clusters_secrets[$cluster_name] {
        $ssl_truststore_password = $presto_clusters_secrets[$cluster_name]['ssl_truststore_password']

        # Needed by the presto-cli tool to validate the coordinator's TLS cert
        $ssl_truststore_path = '/etc/presto/truststore.jks'
        # Needed by libs like presto-python-client to validate the coordinator's TLS cert
        $ssl_ca_cert_path = '/etc/presto/ca.crt.pem'

        file { $ssl_truststore_path:
            content => secret("certificates/presto_${cluster_name}/root_ca/truststore.jks"),
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
            require => Package['presto-cli'],
        }

        file { $ssl_ca_cert_path:
            content => secret("certificates/presto_${cluster_name}/root_ca/ca.crt.pem"),
            owner   => 'root',
            group   => 'root',
            mode    => '0444',
        }

        file { '/usr/local/bin/presto':
            owner   => 'root',
            group   => 'root',
            mode    => '0555',
            content => template('profile/presto/presto_client_ssl_kerberos.erb'),
            require => Package['presto-cli'],
        }
    }

    class { '::presto::client':
        discovery_uri => $discovery_uri,
    }
}