summaryrefslogtreecommitdiff
path: root/roles/kodi/standalone/tasks/main.yml
blob: 9cb891cf5c55f8a1cefbaae610fc054587f12f76 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
- name: install support packages
  apt:
    name:
    - policykit-1
    - udisks2
    - upower
    - fonts-noto
    - fonts-roboto
    - fonts-roboto-fontface
    - nfs-common
    - cifs-utils
    - avahi-daemon
    state: present
  notify: restart kodi

- name: install extra support packages
  when: kodi_standalone_support_packages_extra is defined
  apt:
    name: "{{ kodi_standalone_support_packages_extra }}"
    state: present
  notify: restart kodi

- name: use kodi packages from backports
  when: kodi_standalone_use_backports
  block:
  - name: add backports repo
    include_role:
      name: apt-repo/backports

  - name: pin kodi packages to use backports
    when: kodi_standalone_use_backports
    copy:
      content: |
        Package: src:kodi {{ kodi_standalone_kodi_packages_extra | join(' ') }}
        Pin: release n={{ ansible_distribution_release }}-backports
        Pin-Priority: 990
      dest: /etc/apt/preferences.d/kodi-backports.pref

- name: install kodi packages
  apt:
    name: "{{ ['kodi'] | union(kodi_standalone_kodi_packages_extra) }}"
    state: present
  notify: restart kodi

- name: add user for kodi
  user:
    name: kodi
    state: present
    password: "!"

- name: make sure policykit config directories exist
  loop:
  - /etc/polkit-1/rules.d
  - /etc/polkit-1/localauthority/50-local.d
  file:
    path: "{{ item }}"
    state: directory

- name: install policykit configuration
  loop:
  - src: polkit.rules.j2
    dest: /etc/polkit-1/rules.d/99-kodi.rules
  - src: polkit-legacy.pkla.j2
    dest: /etc/polkit-1/localauthority/50-local.d/99-kodi.pkla
  loop_control:
    label: "{{ item.dest }}"
  template:
    src: "{{ item.src }}"
    dest: "{{ item.dest }}"
  notify: restart kodi

- name: install systemd service unit
  template:
    src: kodi.service.j2
    dest: /etc/systemd/system/kodi.service
  notify: restart kodi

- name: make sure kodi service unit is enabled and started
  systemd:
    daemon_reload: yes
    name: kodi.service
    state: started
    enabled: yes

- name: make sure systemd default target is set to graphical.target
  file:
    src: /lib/systemd/system/graphical.target
    dest: /etc/systemd/system/default.target
    state: link