summaryrefslogtreecommitdiff
path: root/roles/streaming/dolmetsch-raspi/tasks/main.yml
blob: c525c3cd41ba69d940b6e816cfdbfe261a625a7a (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
---
- name: install packages
  apt:
    name:
    - gstreamer1.0-tools
    - gstreamer1.0-plugins-base
    - gstreamer1.0-plugins-good
    - gstreamer1.0-plugins-bad
    - gstreamer1.0-alsa
    - git
    - libasound2-dev
    - telnet

- name: download golang tarball
  get_url:
    url: "https://dl.google.com/go/go{{ dolmetsch_raspi_golang_version }}.linux-armv6l.tar.gz"
    dest: "/usr/local/src/go{{ dolmetsch_raspi_golang_version }}.linux-armv6l.tar.gz"
    checksum: "{{ dolmetsch_raspi_golang_checksum }}"

- name: check current goloang version (if any)
  command: /usr/local/go/bin/go version
  ignore_errors: yes
  check_mode: no
  changed_when: false
  register: golang_version

- name: update golang installation
  when: golang_version is failed or golang_version.stdout != ("go version go" + dolmetsch_raspi_golang_version + " linux/arm")
  block:
  - name: remove old golang installation
    file:
      path: /usr/local/go
      state: absent

  - name: extract the golang tarball
    environment: ### TODO: remove once this lands in ansible: https://github.com/ansible/ansible/pull/76542
      LANGUAGE: en_US.utf8
    unarchive:
      src: "/usr/local/src/go{{ dolmetsch_raspi_golang_version }}.linux-armv6l.tar.gz"
      dest: /usr/local
      copy: no

- name: clone dolmetschctl repo
  git:
    repo: https://git.spreadspace.org/dolmetschctl
    dest: /opt/dolmetschctl

- name: build dolmetschctl (server and client)
  loop:
  - dolmetschctl
  - dolmetschctld
  command: "/usr/local/go/bin/go build -o {{ item }} ./cmd/{{ item }}"
  args:
    chdir: /opt/dolmetschctl
    creates: "/opt/dolmetschctl/{{ item }}"
  environment:
    GOPATH: /opt/.gopath

- name: install dolmetschctl systemd units
  loop:
  - dolmetschctl
  - dolmetschctld
  template:
    src: "{{ item }}.service.j2"
    dest: "/etc/systemd/system/{{ item }}.service"
  notify: reload systemd

- name: install rtp send/receive scripts
  loop:
  - rtp-recv
  - rtp-send
  template:
    src: "{{ item }}.sh.j2"
    dest: "/usr/local/bin/{{ item }}.sh"
    mode: 0750

- name: install rtp send/receive systemd units
  loop:
  - rtp-recv
  - rtp-send
  template:
    src: "{{ item }}.service.j2"
    dest: "/etc/systemd/system/{{ item }}.service"
  notify: reload systemd