---
- name: setup jenkins slaves
  hosts: jenkins_slaves
  user: root
  vars_files:
    - "vars/{{ ansible_facts['os_family'] }}-{{ ansible_facts['distribution_major_version']}}.yml"
  tasks:
    - name: install common utilities
      apt:
        name:
          - ca-certificates
          - etckeeper
          - ncdu
          - osc  # OS#6706
          - rpm2cpio  # OS#6706
          - rsync
          - screen
          - tmux
          - tree
          - vim
          - zip  # OS#6706
        cache_valid_time: 3600
        update_cache: yes
  roles:
    - name: apt-allow-relinfo-change

    - name: docker
      jenkins_user: osmocom-build
      tags:
        - docker

    - name: podman
      when: ansible_distribution == 'Debian' and ansible_distribution_version|int >= 11
      jenkins_user: osmocom-build
      tags:
        - podman

    - name: install-poky-sdk
      when: ansible_architecture == "x86_64"
      jenkins_user: osmocom-build
      poky_installer_file: poky-glibc-x86_64-meta-toolchain-osmo-cortexa15hf-neon-toolchain-osmo-2.3.4.sh
      poky_dest: /opt/poky-oc2g/2.3.4/
      tags:
        - poky

    - name: install-poky-sdk
      when: ansible_architecture == "x86_64"
      jenkins_user: osmocom-build
      poky_installer_file: poky-glibc-x86_64-meta-toolchain-osmo-armv5te-toolchain-osmo-2.3.4.sh
      poky_dest: /opt/poky-sdk/2.3.4/
      tags:
        - poky

    - name: osmocom-jenkins-slave
      jenkins_user: osmocom-build
      generic_slave: true
      tags:
        - jenkins-slave

    - name: ntpd

- name: setup coverity slaves
  hosts: coverity_slaves
  user: root
  roles:
    - name: install-coverity
      tags:
        - coverity

- name: setup qemu images
  hosts: qemu
  user: root
  roles:
    - name: qemu
      jenkins_user: osmocom-build
      tags:
        - qemu