| 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: Update apt cache / upgrade packages via apt |
| 23 | apt: |
| 24 | update_cache: yes |
| 25 | upgrade: yes |
| 26 | when: |
| 27 | - ansible_facts['distribution'] in ['Ubuntu', 'Debian'] |
| 28 | |
| 29 | # the package lists are updated by "make lcitool-refresh" |
| 30 | - name: Define package list file path for Ubuntu |
| 31 | set_fact: |
| 32 | package_file: "ubuntu/ubuntu-2404-{{ ansible_facts['architecture'] }}.yaml" |
| 33 | when: |
| 34 | - ansible_facts['distribution'] == 'Ubuntu' |
| 35 | - ansible_facts['distribution_version'] == '24.04' |
| 36 | |
| 37 | - name: Define package list file path for Debian |
| 38 | set_fact: |
| 39 | package_file: "debian/debian-{{ ansible_facts['distribution_major_version'] }}-{{ ansible_facts['architecture'] }}.yaml" |
| 40 | when: |
| 41 | - ansible_facts['distribution'] == 'Debian' |
| 42 | |
| 43 | - name: Include package lists based on OS and architecture |
| 44 | include_vars: |
| 45 | file: "{{ package_file }}" |
| 46 | when: |
| 47 | - package_file is exists |
| 48 | |
| 49 | - name: Install packages for QEMU on Ubuntu/Debian |
| 50 | package: |
| 51 | name: "{{ packages }}" |
| 52 | when: |
| 53 | - package_file is exists |
| 54 | - packages is defined |
| 55 | |
| 56 |