Puppet Class: cpufrequtils

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

Summary

This class installs the cpufrequtils package and ensures a configured CPU frequency governor is set.

Overview

SPDX-License-Identifier: Apache-2.0

Examples:


class { 'cpufrequtils':
  governor => 'powersave',
}

Parameters:

  • governor (String) (defaults to: 'performance')

    Which governor to use. Defaults to 'performance'. Run 'cpufreq-info -g' to obtain a list of available governors.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'modules/cpufrequtils/manifests/init.pp', line 14

class cpufrequtils(
    String $governor = 'performance'
) {
    unless $facts['is_virtual'] {
        ensure_packages('cpufrequtils')

        file { '/etc/default/cpufrequtils':
            content => "GOVERNOR=${governor}\n",
            require => Package['cpufrequtils'],
            notify  => Service['cpufrequtils'],
        }

        service { 'cpufrequtils':
            ensure => 'running',
            enable => true,
            status => "/usr/bin/cpufreq-info -p | /bin/grep -wq ${governor}",
        }
    }
}