1# Copyright (c) 2021 Red Hat, Inc.
2#
3# Author:
4#  Cleber Rosa <crosa@redhat.com>
5#
6# This work is licensed under the terms of the GNU GPL, version 2 or
7# later.  See the COPYING file in the top-level directory.
8#
9# This is an ansible playbook file.  Run it to set up systems with the
10# environment needed to build QEMU.
11---
12- name: Installation of basic packages to build QEMU
13  hosts: all
14  tasks:
15    - name: Check for suitable ansible version
16      delegate_to: localhost
17      assert:
18        that:
19          - '((ansible_version.major == 2) and (ansible_version.minor >= 8)) or (ansible_version.major >= 3)'
20        msg: "Unsuitable ansible version, please use version 2.8.0 or later"
21
22    - name: Add armhf foreign architecture to aarch64 hosts
23      command: dpkg --add-architecture armhf
24      when:
25        - ansible_facts['distribution'] == 'Ubuntu'
26        - ansible_facts['architecture'] == 'aarch64'
27
28    - name: Update apt cache / upgrade packages via apt
29      apt:
30        update_cache: yes
31        upgrade: yes
32      when:
33        - ansible_facts['distribution'] == 'Ubuntu'
34
35    # the package lists are updated by "make lcitool-refresh"
36    - name: Include package lists based on OS and architecture
37      include_vars:
38        file: "ubuntu-2204-{{ ansible_facts['architecture'] }}.yaml"
39      when:
40        - ansible_facts['distribution'] == 'Ubuntu'
41        - ansible_facts['distribution_version'] == '22.04'
42
43    - name: Install packages for QEMU on Ubuntu 22.04
44      package:
45        name: "{{ packages }}"
46      when:
47        - ansible_facts['distribution'] == 'Ubuntu'
48        - ansible_facts['distribution_version'] == '22.04'
49
50    - name: Install armhf cross-compile packages to build QEMU on AArch64 Ubuntu 22.04
51      package:
52        name:
53          - binutils-arm-linux-gnueabihf
54          - gcc-arm-linux-gnueabihf
55          - libblkid-dev:armhf
56          - libc6-dev:armhf
57          - libffi-dev:armhf
58          - libglib2.0-dev:armhf
59          - libmount-dev:armhf
60          - libpcre2-dev:armhf
61          - libpixman-1-dev:armhf
62          - zlib1g-dev:armhf
63      when:
64        - ansible_facts['distribution'] == 'Ubuntu'
65        - ansible_facts['distribution_version'] == '22.04'
66        - ansible_facts['architecture'] == 'aarch64'
67
68