aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/linux_status/tasks/main.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-08-07 11:06:33 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-08-07 19:38:45 +0200
commit7ccc51aad5ea52b26b27faf6d00413c94bf02f46 (patch)
tree4dd0bb7670b4c90e5c97350312dede37357a19cd /roles/linux_status/tasks/main.yml
parentlinux_status: factor out PPA set up to a separate role (diff)
downloadinfra-ansible-7ccc51aad5ea52b26b27faf6d00413c94bf02f46.tar.gz
infra-ansible-7ccc51aad5ea52b26b27faf6d00413c94bf02f46.zip
factor out systemd service editing
Diffstat (limited to '')
-rw-r--r--roles/linux_status/tasks/main.yml27
1 files changed, 5 insertions, 22 deletions
diff --git a/roles/linux_status/tasks/main.yml b/roles/linux_status/tasks/main.yml
index 6ce23f9..1383699 100644
--- a/roles/linux_status/tasks/main.yml
+++ b/roles/linux_status/tasks/main.yml
@@ -15,27 +15,10 @@
- name: Disable power management
when: linux_status_disable_power_management
- become: true
+ ansible.builtin.include_role:
+ name: systemd_edit
vars:
service_name: linux-status
- block:
- - name: 'Create override directory: {{ service_name }}'
- ansible.builtin.file:
- path: '/etc/systemd/system/{{ service_name }}.service.d'
- state: directory
-
- - name: 'Set up override: {{ service_name }}'
- community.general.ini_file:
- dest: '/etc/systemd/system/{{ service_name }}.service.d/override.conf'
- section: Unit
- option: ExecStart
- values: ['', '/usr/bin/python3 -B server.py --disable-power']
- no_extra_spaces: true
- register: overridden
-
- - name: 'Restart service: {{ service_name }}'
- ansible.builtin.systemd_service:
- daemon_reload: true
- name: '{{ service_name }}'
- state: restarted
- when: overridden.changed
+ service_section: Service
+ service_option: ExecStart
+ service_values: ['', '/usr/bin/python3 -B server.py --disable-power']