blob: 1fa381fe31ce0d5950c2b464b6b778acc9b381ab (
plain) (
tree)
|
|
- name: Set up repository
become: true
block:
- name: Create keys directory
ansible.builtin.file:
path: '{{ keys_dir }}'
mode: '755'
state: directory
- name: Add key
ansible.builtin.get_url:
url: 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x{{ gpg_key_id }}'
dest: '{{ keys_dir }}/linux-status.asc'
mode: '644'
- name: Add repository
ansible.builtin.apt_repository:
repo: 'deb [signed-by={{ keys_dir }}/linux-status.asc] https://ppa.launchpadcontent.net/egor-tensin/linux-status/ubuntu focal main'
filename: linux-status
- 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
|