summaryrefslogtreecommitdiff
path: root/roles/streaming/blackmagic/desktopvideo/tasks/main.yml
blob: 3906e2065b40eabc21a7491b4fd558e7a3519470 (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
---
- name: install blackmagic repo
  import_role:
    name: apt-repo/blackmagic

- name: install xauth package for SSH X-Forwarding to work
  when: blackmagic_desktopvideo_include_gui
  apt:
    name: xauth
    state: present

- name: generate list of desktopvideo packages
  set_fact:
    blackmagic_desktopvideo_packages: "{{ ['desktopvideo'] | union(blackmagic_desktopvideo_include_gui | ternary(['desktopvideo-gui'], [])) }}"

- name: generate apt pin files for desktopvideo packages
  when: blackmagic_desktopvideo_version is defined
  loop: "{{ blackmagic_desktopvideo_packages }}"
  copy:
    dest: "/etc/apt/preferences.d/{{ item }}.pref"
    content: |
      Package: {{ item }}
      Pin: version {{ blackmagic_desktopvideo_version }}
      Pin-Priority: 1001

- name: remove apt pin files for desktopvideo packages
  when: blackmagic_desktopvideo_version is not defined
  loop: "{{ blackmagic_desktopvideo_packages }}"
  file:
    path: "/etc/apt/preferences.d/{{ item }}.pref"
    state: absent

- name: install blackmagic desktopvideo packages
  apt:
    name: "{{ blackmagic_desktopvideo_packages | product(blackmagic_desktopvideo_version is defined | ternary(['=' + (blackmagic_desktopvideo_version | default(''))], [''])) | map('join') }}"
    state: present
    force: yes
    # allow_downgrade: yes
    ## TODO: replace force with allow_downgrade once the following change is available (ansible >= 5.0)
    ##   https://github.com/ansible/ansible/pull/74852

- name: install improved kill mode for DesktopVideoHelper (1/2)
  file:
    name: /etc/systemd/system/DesktopVideoHelper.service.d
    state: directory

- name: install improved kill mode for DesktopVideoHelper (1/2)
  copy:
    src: DesktopVideoHelper-killmode.conf
    dest: /etc/systemd/system/DesktopVideoHelper.service.d/killmode.conf
  notify: reload systemd

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