Merge pull request #226 from longns1/main

add k3s_service_exec_start_pre_vars for the k3s service
This commit is contained in:
Ayrton 2024-10-15 16:55:58 -03:00 committed by GitHub
commit 6ff67804dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -107,6 +107,19 @@ k3s_service_env_vars: {}
# the target as this role will not populate this file.
k3s_service_env_file: false
# Additional ExecStartPre commands for the k3s service in systemd
# This dictionary can be used to specify additional ExecStartPre commands
# for the k3s service. These commands will be executed before the main
# service starts. For example, the command below removes the
# cpu_manager_state file if it exists.
#
# Usage example:
# k3s_service_exec_start_pre_vars:
# - "-/usr/bin/rm -f /var/lib/kubelet/cpu_manager_state"
#
# Note: The "-" prefix before the command ensures that systemd ignores
# any errors that occur when executing the command.
k3s_service_exec_start_pre_vars: {}
##
# Server Configuration

View File

@ -29,6 +29,11 @@ EnvironmentFile={{ k3s_service_env_file }}
ExecStartPre=/bin/sh -xc '! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service'
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
{% if k3s_service_exec_start_pre_vars is defined and k3s_service_exec_start_pre_vars is iterable %}
{% for exec_start_pre_var in k3s_service_exec_start_pre_vars %}
ExecStartPre={{ exec_start_pre_var }}
{% endfor %}
{% endif %}
{% filter regex_replace('\s+', ' ') %}
{% filter replace('\n', ' ') %}
ExecStart={{ k3s_install_dir }}/k3s