---

- name: install bench-worker packages
  apt:
    force_apt_get: true
    name: "{{ bench_worker_packages }}"
    state: present

- name: deploy worker launcher
  notify:
    - reload systemd daemon
    - restart bench-worker
  template:
    src: mediaserver-benchmark-start.j2
    dest: /usr/bin/mediaserver-benchmark-start
    mode: 0755

- name: deploy bench-worker service
  notify: restart bench-worker
  template:
    src: bench-worker.service.j2
    dest: /etc/systemd/system/bench-worker.service

- name: ensure configuration directory exists
  file:
    path: /etc/mediaserver
    state: directory

- name: benchmark configuration settings
  notify:
    - restart bench-worker
  copy:
    dest: /etc/mediaserver/bench.conf
    content: |
      BENCH_SERVER={{ bench_server }}
      BENCH_HOST=https://{{ bench_host }}
      BENCH_USER={{ bench_user }}
      BENCH_PASSWORD={{ bench_password }}
      BENCH_OID={{ bench_oid }}
      BENCH_TIME_STAT={{ bench_time_stat }}

...
