Skip to content

Commit 6c419ba

Browse files
bertiethorpesjpb
andcommitted
Add TuneD (#409)
* TuneD configuration role * bump CI image * Update README.md * Update environments/common/layouts/everything Co-authored-by: Steve Brasier <[email protected]> * Update ansible/roles/tuned/README.md Co-authored-by: Steve Brasier <[email protected]> * Update ansible/roles/tuned/README.md Co-authored-by: Steve Brasier <[email protected]> * Update ansible/roles/tuned/README.md Co-authored-by: Steve Brasier <[email protected]> * Update README.md --------- Co-authored-by: Bertie <[email protected]> Co-authored-by: Steve Brasier <[email protected]>
1 parent b4bab26 commit 6c419ba

File tree

10 files changed

+69
-0
lines changed

10 files changed

+69
-0
lines changed

ansible/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ roles/*
5656
!roles/ofed/**
5757
!roles/squid/
5858
!roles/squid/**
59+
!roles/tuned/
60+
!roles/tuned/**
61+

ansible/bootstrap.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@
105105
import_role:
106106
name: squid
107107

108+
- hosts: tuned
109+
tags: tuned
110+
gather_facts: yes
111+
become: yes
112+
tasks:
113+
- name: Install and configure tuneD
114+
import_role:
115+
name: tuned
116+
108117
- hosts: freeipa_server
109118
# Done here as it might be providing DNS
110119
tags:

ansible/roles/tuned/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
tuned
2+
=========
3+
4+
This role configures the TuneD tool for system tuning, ensuring optimal performance based on the profile settings defined.
5+
6+
Role Variables
7+
--------------
8+
9+
See the [TuneD documentation](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/monitoring_and_managing_system_status_and_performance/getting-started-with-tuned_monitoring-and-managing-system-status-and-performance) for profile details.
10+
11+
12+
- `tuned_profile_baremetal`: Optional str. Name of default profile for non-virtualised hosts. Default `hpc-compute`.
13+
- `tuned_profile_vm`: Optional str. Name of default profile for virtualised hosts. Default `virtual-guest`.
14+
- `tuned_profile`: Optional str. Name of profile to apply to host. Defaults to `tuned_profile_baremetal` or `tuned_profile_vm` as appropriate.

ansible/roles/tuned/defaults/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# defaults file for tuned
3+
tuned_profile_baremetal: hpc-compute
4+
tuned_profile_vm: virtual-guest
5+
tuned_profile: "{{ tuned_profile_baremetal if ansible_virtualization_role != 'guest' else tuned_profile_vm }}"
6+
tuned_enabled: true
7+
tuned_started: true
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
- name: Enable and start TuneD
3+
ansible.builtin.systemd:
4+
name: tuned
5+
enabled: "{{ tuned_enabled | bool }}"
6+
state: "{{ 'started' if tuned_started | bool else 'stopped' }}"
7+
8+
- name: Check TuneD profile
9+
ansible.builtin.command:
10+
cmd: tuned-adm active
11+
when: tuned_started
12+
register: _tuned_profile_current
13+
changed_when: false
14+
15+
- name: Set tuned-adm profile
16+
ansible.builtin.command:
17+
cmd: "tuned-adm profile {{ tuned_profile }}"
18+
when:
19+
- tuned_started | bool
20+
- tuned_profile not in _tuned_profile_current.stdout

ansible/roles/tuned/tasks/install.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Install tuneD
3+
ansible.builtin.dnf:
4+
name: tuned
5+
state: present

ansible/roles/tuned/tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
- import_tasks: install.yml
3+
- import_tasks: configure.yml

environments/common/inventory/group_vars/builder/defaults.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ squid_started: false
2020
squid_enabled: false
2121
squid_cache_disk: 0 # just needs to be defined
2222
squid_cache_mem: 0
23+
tuned_started: false
24+
tuned_enabled: false

environments/common/inventory/groups

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,6 @@ freeipa_client
129129

130130
[squid]
131131
# Hosts to run squid proxy
132+
133+
[tuned]
134+
# Hosts to run TuneD configuration

environments/common/layouts/everything

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,6 @@ openhpc
7575

7676
[squid]
7777
# Hosts to run squid proxy
78+
79+
[tuned:children]
80+
# Hosts to run TuneD configuration

0 commit comments

Comments
 (0)