Puppet Class: r10k::config

Inherits:
r10k::params
Defined in:
manifests/config.pp

Overview

Class: r10k::config

Set up the root r10k config file (/etc/r10k.yaml).

Parameters

  • cachedir

    Path to a directory to be used by r10k for caching data. Default: /var/cache/r10k

  • sources

    Hash containing data sources to be used by r10k to create dynamic Puppet environments. Default: {}

  • postrun

    Optional: Array containing the parts of a system call. Example: [‘/usr/bin/curl’, ‘-F’, ‘deploy=done’, ‘my-app.site/endpoint’] Default: undef

  • manage_configfile_symlink

    Boolean to determine if a symlink to the r10k config file is to be managed. Default: false

  • configfile_symlink

    Location of symlink that points to configfile. Default: /etc/r10k.yaml

  • forge_settings

    Hash containing settings for downloading modules from the Puppet Forge.

  • proxy

    String containing proxy setting for r10k.yaml. Default: undef

  • pool_size

    Integer defining how many threads should be spawn while updating modules. Only available for r10k >= 3.3.0. Default: undef

Examples

class { 'r10k::config':
  sources => {
    'somename' => {
      'remote'  => 'ssh://git@github.com/someuser/somerepo.git',
      'basedir' => "${::settings::confdir}/environments"
    },
    'someothername' => {
      'remote'  => 'ssh://git@github.com/someuser/someotherrepo.git',
      'basedir' => '/some/other/basedir'
    },
  },
}

Documentation

Authors

Charlie Sharpsteen <source@sharpsteen.net> Zack Smith <zack@puppetlabs.com>

Parameters:

  • configfile (Any) (defaults to: $r10k::params::r10k_config_file)
  • cachedir (Any) (defaults to: $r10k::params::r10k_cache_dir)
  • sources (Optional[Hash]) (defaults to: $r10k::params::sources)
  • modulepath (Any) (defaults to: $r10k::params::modulepath)
  • remote (Any) (defaults to: $r10k::params::remote)
  • manage_modulepath (Boolean) (defaults to: $r10k::params::manage_modulepath)
  • r10k_basedir (Stdlib::Absolutepath) (defaults to: $r10k::params::r10k_basedir)
  • manage_configfile_symlink (Boolean) (defaults to: $r10k::params::manage_configfile_symlink)
  • configfile_symlink (Stdlib::Absolutepath) (defaults to: $r10k::params::configfile_symlink)
  • git_settings (Hash) (defaults to: $r10k::params::git_settings)
  • forge_settings (Hash) (defaults to: $r10k::params::forge_settings)
  • deploy_settings (Hash) (defaults to: $r10k::params::deploy_settings)
  • postrun (Optional[Array]) (defaults to: undef)
  • root_user (Any) (defaults to: $r10k::params::root_user)
  • root_group (Any) (defaults to: $r10k::params::root_group)
  • puppetconf_path (Stdlib::Absolutepath) (defaults to: $r10k::params::puppetconf_path)
  • proxy (Optional[String[1]]) (defaults to: $r10k::params::proxy)
  • pool_size (Optional[Integer[1]]) (defaults to: $r10k::params::pool_size)
  • r10k_yaml_template (String) (defaults to: 'r10k/r10k.yaml.erb')


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
# File 'manifests/config.pp', line 54

class r10k::config (
  $configfile                               = $r10k::params::r10k_config_file,
  $cachedir                                 = $r10k::params::r10k_cache_dir,
  Optional[Hash] $sources                   = $r10k::params::sources,
  $modulepath                               = $r10k::params::modulepath,
  $remote                                   = $r10k::params::remote,
  Boolean $manage_modulepath                = $r10k::params::manage_modulepath,
  Stdlib::Absolutepath $r10k_basedir        = $r10k::params::r10k_basedir,
  Boolean $manage_configfile_symlink        = $r10k::params::manage_configfile_symlink,
  Stdlib::Absolutepath $configfile_symlink  = $r10k::params::configfile_symlink,
  Hash $git_settings                        = $r10k::params::git_settings,
  Hash $forge_settings                      = $r10k::params::forge_settings,
  Hash $deploy_settings                     = $r10k::params::deploy_settings,
  Optional[Array] $postrun                  = undef,
  $root_user                                = $r10k::params::root_user,
  $root_group                               = $r10k::params::root_group,
  Stdlib::Absolutepath $puppetconf_path     = $r10k::params::puppetconf_path,
  Optional[String[1]] $proxy                = $r10k::params::proxy,
  Optional[Integer[1]] $pool_size           = $r10k::params::pool_size,
  String $r10k_yaml_template                = 'r10k/r10k.yaml.erb',
) inherits r10k::params {
  if $sources == undef {
    $r10k_sources  = {
      'puppet' => {
        'remote'  => $remote,
        'basedir' => $r10k_basedir,
      },
    }
    $source_keys = keys($r10k_sources)
  } else {
    $r10k_sources = $sources
    $source_keys = keys($r10k_sources)
  }

  if $configfile == '/etc/puppetlabs/r10k/r10k.yaml' {
    file { '/etc/puppetlabs/r10k':
      ensure => 'directory',
      owner  => $root_user,
      group  => $root_group,
      mode   => '0755',
    }
  }

  file { 'r10k.yaml':
    ensure  => file,
    owner   => $root_user,
    group   => $root_group,
    mode    => '0644',
    path    => $configfile,
    content => template($r10k_yaml_template),
  }

  if $manage_configfile_symlink {
    file { 'symlink_r10k.yaml':
      ensure => 'link',
      path   => $configfile_symlink,
      target => $configfile,
    }
  }

  if $manage_modulepath {
    ini_setting { 'R10k Modulepath':
      ensure  => present,
      path    => "${puppetconf_path}/puppet.conf",
      section => 'main',
      setting => 'modulepath',
      value   => $modulepath,
    }
  }
}