---
- name: update apt-cache
  apt:
    cache_valid_time: 3600
    update_cache: yes

- name: ip.access install apt dependencies
  apt:
    name: python3-usb

- name: ip.access install pip3 dependencies
  pip:
    name: pysispm
    executable: pip3

- name: usrp install apt dependecies
  apt:
    name:
      - libuhd-dev
      - uhd-host
    cache_valid_time: 3600
    update_cache: yes
  register: uhd_installed

- name: usrp download firmware
  command: uhd_images_downloader
  args:
    creates: /usr/share/uhd/images
  when: uhd_installed is changed

- name: usrp allow jenkins to access
  user:
    name: jenkins
    groups: usrp
    append: yes

- name: add apt-key of OBS network:osmocom:nightly
  apt_key:
    data: "{{ lookup('file', 'Release.key') }}"
    state: present

- name: add apt-repo of OBS network:osmocom:nightly
  apt_repository:
    filename: obs_network_osmocom_latest
    repo: "deb https://downloads.osmocom.org/packages/osmocom:/nightly/Debian_{{ ansible_distribution_major_version }}.0/ ./"
    update_cache: yes

- name: install osmocom utilities
  apt:
    name:
      - abisip-find
      - osmo-bsc-ipaccess-utils
      - osmo-bsc-bs11-utils