Defined Type: elasticsearch::script

Defined in:
manifests/script.pp

Overview

This define allows you to insert, update or delete scripts that are used

within Elasticsearch.

Parameters:

  • ensure (String) (defaults to: 'present')

    Controls the state of the script file resource to manage. Values are simply passed through to the ‘file` resource.

  • recurse (Optional[Variant[Boolean, Enum['remote']]]) (defaults to: undef)

    Will be passed through to the script file resource.

  • source (String)

    Puppet source of the script

Author:

  • Richard Pijnenburg <richard.pijnenburg@elasticsearch.com>

  • Tyler Langlois <tyler.langlois@elastic.co>



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'manifests/script.pp', line 17

define elasticsearch::script (
  String                                     $source,
  String                                     $ensure  = 'present',
  Optional[Variant[Boolean, Enum['remote']]] $recurse = undef,
) {
  if ! defined(Class['elasticsearch']) {
    fail('You must include the elasticsearch base class before using defined resources')
  }

  $filename_array = split($source, '/')
  $basefilename = $filename_array[-1]

  file { "${elasticsearch::homedir}/scripts/${basefilename}":
    ensure  => $ensure,
    source  => $source,
    owner   => $elasticsearch::elasticsearch_user,
    group   => $elasticsearch::elasticsearch_group,
    recurse => $recurse,
    mode    => '0644',
  }
}