Installs Powertop on Debian based systems, from source if the package manager's version does not support your CPU properly. Also installs a one-shot type service to automatically optimize power consumption at system startup.
Key Features:
- Set
powertop_state
to either install or remove Powertop - Install Powertop from a specific source tag instead of package manager in case the package manager provided version is too old
- Switch between specific versions installed from source
- Switch between installation from package manager and source (or vice versa)
Dependencies: None
Compatibility:
This role is tested with
- Debian 11 Bullseye
- Debian 12 Bookworm
- Ubuntu 22.04 LTS Jammy Jellyfish
- Ubuntu 24.04 LTS Noble Numbat
By default, the role will check for a compatible operating system and version (any of the above). To disable that check, set the role variable powertop_verify_os
to false
.
By default the role will install Powertop using the package manager. If the system's package manager comes with an older Powertop package, it is possible to install Powertop from source. The role will automatically install all build dependencies, check out the desired source version, compile and install Powertop from source.
It is also possible to use this role for updating Powertop installed from source to a newer version (or downgrade to an older version). The old version is uninstalled before the new version is installed.
The role supports switching between Powertop installed by package manager and installed from source (and vice versa).
The following variables control installation from source:
Variable | Description |
---|---|
|
Flag indicating whether to install Powertop from source or not. All the variables below have no effect if not set to true .Default: false
|
|
The URL to the Git Repository to compile Powertop from. Default: https://github.com/fenrus75/powertop.git
|
|
The Git Tag to check out before compiling Powertop. Can be a branch name as well. Default: v2.15
|
|
Flag indicating whether to install libtraceevent from source or not. This is a dependency for compiling Powertop, which might be too old when installed from package manager.If set to false , it is the user's responsibility to make sure this dependency is met.Default: true
|
|
The URL to the Git Repository to compile libtraceevent from. Default: https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git
|
|
The Git Tag to check out before compiling libtraceevent .Can be a branch name as well. Default: libtraceevent-1.8.4
|
|
Flag indicating whether to install libtracefs from source or not. This is a dependency for compiling Powertop, which might be too old when installed from package manager.If set to false , it is the user's responsibility to make sure this dependency is met.Default: true
|
|
The URL to the Git Repository to compile libtracefs from.Default: https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git
|
|
The Git Tag to check out before compiling libtracefs .Can be a branch name as well. Default: libtracefs-1.8.1
|
Available variables are listed below, along with default values (see defaults/main.yml
).
powertop_state: present
Determines whether Powertop should be installed or not installed on the target system.
Allowed values in this role are present
and absent
.
powertop_verify_os: true
Controls whether the role verifies if the target system is running a supported operating system.
powertop_manage_service: true
Controls whether a one-shot type systemd service is installed to run powertop --auto-tune
at system startup.
powertop_service_name: "powertop"
The name of the Powertop systemd service. Only has any effect if powertop_manage_servce
is set to true
.
- hosts: all
gather_facts: true
roles:
- role: salvoxia.powertop
- hosts: all
gather_facts: true
roles:
- role: salvoxia.powertop
powertop_install_from_source: true
powertop_source_tag: v2.15
Run a Docker container with systemd:
sudo docker run --tmpfs /tmp --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host --privileged --name sysd --rm geerlingguy/docker-debian11-ansible
MIT
This role was created in 2024 by Salvoxia ([email protected]).