Defined Type: tuned::profile
- Defined in:
- manifests/profile.pp
Overview
Define: tuned::profile
This define permit the definition of a new tuned profile
Parameters:
- ensure
-
String. Ensure if present of absent Default: ‘present’ Valid values: present, absent
- profile_name
-
String. The profile name Default: $title
- conf_content
-
String. Content of tuned profile Default: undef
- scripts
-
String. Scripts used by tuned profile Default: {}
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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'manifests/profile.pp', line 24
define tuned::profile (
$ensure = 'present',
$profile_name = $title,
$tuned_conf_dir = $tuned::tuned_conf_dir,
$tuned_pkg = $tuned::tuned_pkg,
String $conf_content = undef,
Hash $scripts = {},
) {
if ! defined(Class['tuned']) {
fail('You must include the tuned base class before define a tuned profile')
}
case $ensure {
'present': {
$dir_ensure = 'directory'
$file_ensure = 'file'
}
'absent': {
$dir_ensure = 'absent'
$file_ensure = 'absent'
}
default: {
fail("${ensure} is not supported for ensure.")
}
}
$profile_dir = "${tuned_conf_dir}/${profile_name}"
file { $profile_dir:
ensure => $dir_ensure,
owner => 'root',
group => 'root',
mode => '0755',
purge => true,
recurse => true,
force => true,
require => Package[$tuned_pkg],
before => Class['tuned::profile::enable_profile'],
}
-> file { "${profile_dir}/tuned.conf":
ensure => $file_ensure,
owner => 'root',
group => 'root',
mode => '0644',
content => $conf_content,
before => Class['tuned::profile::enable_profile'],
}
$scripts.each |String $script_name, String $script_content| {
file { "${profile_dir}/${script_name}":
ensure => $file_ensure,
owner => 'root',
group => 'root',
mode => '0755',
content => $script_content,
require => File[$profile_dir],
before => Class['tuned::profile::enable_profile'],
}
}
}
|