Puppet Class: turnilo

Defined in:
modules/turnilo/manifests/init.pp

Overview

Class: turnilo

This class installs and configures the Allegro Turnilo nodejs application.

Turnilo is an open source replacement for Imply Pivot.

Parameters

port

The port used by Turnilo to accept HTTP connections. Default: 9091

druid_clusters

Array of hashes of druid cluster config. Each hash must contain at least 'name' and 'host' with the druid broker hostname:port.

deployment_user

Scap deployment user. Default: 'analytics_deploy'

scap_repo

Scap repository. Default: 'analytics/turnilo/deploy'

Parameters:

  • druid_clusters (Array[Turnilo::Druid_cluster])
  • port (Stdlib::Port) (defaults to: 9091)
  • deployment_user (String) (defaults to: 'analytics_deploy')
  • scap_repo (String) (defaults to: 'analytics/turnilo/deploy')
  • export_names_map (Hash[Stdlib::IP::Address, String]) (defaults to: {})


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
# File 'modules/turnilo/manifests/init.pp', line 25

class turnilo(
    Array[Turnilo::Druid_cluster]     $druid_clusters,
    Stdlib::Port                      $port             = 9091,
    String                            $deployment_user  = 'analytics_deploy',
    String                            $scap_repo        = 'analytics/turnilo/deploy',
    Hash[Stdlib::IP::Address, String] $export_names_map = {},
) {

    ensure_packages(['nodejs', 'firejail'])

    $scap_deployment_base_dir = '/srv/deployment'
    $turnilo_deployment_dir = "${scap_deployment_base_dir}/${scap_repo}"

    scap::target { 'analytics/turnilo/deploy':
        deploy_user  => $deployment_user,
        service_name => 'turnilo',
    }

    systemd::sysuser { 'turnilo':
        shell    => '/bin/bash',
    }

    file { '/etc/firejail/turnilo.profile':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        source  => 'puppet:///modules/turnilo/turnilo.profile.firejail',
        require => Package['firejail'],
    }

    file { '/etc/turnilo':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    file { '/etc/turnilo/config.yaml':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('turnilo/config.yaml.erb'),
        require => File['/etc/turnilo'],
    }

    systemd::syslog { 'turnilo':
        readable_by => 'all',
        base_dir    => '/var/log',
        group       => 'root',
        force_stop  => true,
    }

    systemd::service { 'turnilo':
        ensure  => present,
        content => systemd_template('turnilo'),
        restart => true,
        require => [
            Scap::Target['analytics/turnilo/deploy'],
            File['/etc/firejail/turnilo.profile'],
            File['/etc/turnilo/config.yaml'],
            User['turnilo'],
            Systemd::Syslog['turnilo'],
        ],
    }

    profile::auto_restarts::service { 'turnilo': }
}