Defined Type: openstack::util::envscript

Defined in:
modules/openstack/manifests/util/envscript.pp

Overview

yaml config and convenience script to set credentials for openstack access

Parameters:

  • region (String)
  • keystone_api_fqdn (Stdlib::Fqdn)
  • os_user (String)
  • os_password (String)
  • keystone_api_port (Stdlib::Port) (defaults to: 25000)
  • keystone_api_interface (String) (defaults to: 'public')
  • scriptpath (Optional[Stdlib::Unixpath]) (defaults to: undef)
  • os_db_password (String) (defaults to: '')
  • yaml_mode (Stdlib::Filemode) (defaults to: '0440')
  • clouds_files (Optional[Array[Stdlib::Unixpath]]) (defaults to: undef)
  • os_project (Optional[String]) (defaults to: undef)
  • os_project_domain_id (Optional[String]) (defaults to: undef)
  • os_user_domain_id (Optional[String]) (defaults to: undef)
  • os_system_scope (Optional[String]) (defaults to: undef)
  • do_script (Boolean) (defaults to: true)


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
# File 'modules/openstack/manifests/util/envscript.pp', line 2

define openstack::util::envscript(
    String                     $region,
    Stdlib::Fqdn               $keystone_api_fqdn,
    String                     $os_user,
    String                     $os_password,
    Stdlib::Port               $keystone_api_port      = 25000,
    String                     $keystone_api_interface = 'public',
    Optional[Stdlib::Unixpath] $scriptpath             = undef,
    String                     $os_db_password         = '',
    Stdlib::Filemode           $yaml_mode              = '0440',
    Optional[Array[Stdlib::Unixpath]] $clouds_files    = undef,
    Optional[String]           $os_project             = undef,
    Optional[String]           $os_project_domain_id   = undef,
    Optional[String]           $os_user_domain_id      = undef,
    Optional[String]           $os_system_scope        = undef,
    Boolean                    $do_script              = true,
  ) {
    if $clouds_files {
        $clouds_files.each |$clouds_file| {
            concat::fragment { "${clouds_file}_${title}":
                target  => $clouds_file,
                content => template('openstack/util/clouds_fragment.yaml.erb'),
            }
        }
    }

    if $do_script {
        file { "/etc/${title}.yaml":
            content => template('openstack/util/envscript.yaml.erb'),
            mode    => $yaml_mode,
            owner   => 'root',
            group   => 'root',
        }

        $script = $scriptpath ? {
            undef   => "/usr/local/bin/${title}.sh",
            default => $scriptpath,
        }

        file { $script:
            content => template('openstack/util/envscript.sh.erb'),
            mode    => '0555',
            owner   => 'root',
            group   => 'root',
        }
    }
}