From d51005bf38caf3b8c5a3334527b4ab34c8784a55 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 23 Sep 2023 00:46:31 +0200 Subject: linux_status: get rid of unnecessary service restarts, etc. --- roles/linux_status/tasks/power_management.yml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 roles/linux_status/tasks/power_management.yml (limited to 'roles/linux_status/tasks/power_management.yml') diff --git a/roles/linux_status/tasks/power_management.yml b/roles/linux_status/tasks/power_management.yml new file mode 100644 index 0000000..2288d24 --- /dev/null +++ b/roles/linux_status/tasks/power_management.yml @@ -0,0 +1,30 @@ +- name: Create override directory + become: true + ansible.builtin.file: + path: /etc/systemd/system/linux-status.service.d + state: directory + owner: root + group: root + mode: '755' + +- name: Enable power management + become: true + ansible.builtin.file: + path: /etc/systemd/system/linux-status.service.d/99-disable_power_management.conf + state: absent + when: linux_status_enable_power_management + notify: linux_status_configured + +- name: Disable power management + become: true + ansible.builtin.template: + src: disable_power_management.conf.j2 + dest: /etc/systemd/system/linux-status.service.d/99-disable_power_management.conf + owner: root + group: root + mode: '644' + when: not linux_status_enable_power_management + notify: linux_status_configured + +- name: Restart systemd service if necessary + ansible.builtin.meta: flush_handlers -- cgit v1.2.3