aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/linux_status/tasks/main.yml
blob: 6ce23f9eb6a6d208f1f98c08c9fbf88bb6ef4f7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: Set up repository
  ansible.builtin.include_role:
    name: debian_ppa
  vars:
    ppa_owner: egor-tensin
    ppa_name: linux-status
    ppa_distro: focal
    ppa_key: ecb69cbafc6d7cd8bd67ec35b1089b3051c9384d

- name: Install linux-status
  become: true
  ansible.builtin.apt:
    install_recommends: false
    name: linux-status

- name: Disable power management
  when: linux_status_disable_power_management
  become: true
  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