From fc304c6e72932c76798bb16a88e6172d61a594cf Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Tue, 3 Jun 2025 17:19:32 +0200 Subject: [PATCH] Use systmed drop-in overrides for tunning Instead of leveraging lineinfile, replace it with drop-in config file, as editing /etc/systemd/system.conf might be not safe on some systems, while others may not have that file at all (ie EL10). Change-Id: Idd234bbbc6ceaecc9cfc1aad75c7e94689cff0de --- tasks/lxc_post_install.yml | 8 ++++++-- templates/systemd-overrides.conf.j2 | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 templates/systemd-overrides.conf.j2 diff --git a/tasks/lxc_post_install.yml b/tasks/lxc_post_install.yml index 737d0249..b4881ec4 100644 --- a/tasks/lxc_post_install.yml +++ b/tasks/lxc_post_install.yml @@ -36,6 +36,9 @@ - { src: lxc.default.j2, dest: "{{ system_config_dir }}/lxc", mode: "0644" } - { src: lxc-openstack-common.conf.j2, dest: "/usr/share/lxc/config/common.conf.d/80-openstack-common.conf" } - { src: lxc-system-manage.j2, dest: "/usr/local/bin/lxc-system-manage", mode: "0755" } + - { src: systemd-overrides.conf.j2, dest: "/etc/systemd/system.conf.d/osa-lxc-hosts.conf" } + notify: + - Reload systemd units tags: - lxc-files - lxc-config @@ -51,10 +54,11 @@ - lxc-files - lxc-config -- name: Set systemd DefaultTasksMax value +# NOTE: Remove this task after 2025.1 +- name: Remove DefaultTasksMax value from default config ansible.builtin.lineinfile: dest: /etc/systemd/system.conf - state: present + state: absent regexp: "^.*DefaultTasksMax.*$" line: "DefaultTasksMax={{ lxc_default_tasks_max }}" when: diff --git a/templates/systemd-overrides.conf.j2 b/templates/systemd-overrides.conf.j2 new file mode 100644 index 00000000..db62803f --- /dev/null +++ b/templates/systemd-overrides.conf.j2 @@ -0,0 +1,4 @@ +# {{ ansible_managed }} + +[Manager] +DefaultTasksMax={{ lxc_default_tasks_max }}