debian-forge-composer/templates/packer/ansible/roles/common/tasks/packages.yml
Sanne Raymaekers 4629a31f22 templates/packer: use python3.10 on fedora
Ansible on fedora 40 seems broken, the default python 3.12 interpreter
doesn't work, 3.10 works but then the dnf module breaks.

Use 3.10 and stop using the dnf module.
2024-05-31 13:55:58 +02:00

146 lines
3.3 KiB
YAML

---
- name: Add osbuild-composer repository
tags:
- ci
yum_repository:
name: "composer"
description: "osbuild-composer commit {{ COMPOSER_COMMIT }}"
baseurl: "http://osbuild-composer-repos.s3.amazonaws.com/osbuild-composer/{{ rpmrepo_distribution }}/{{ ansible_architecture }}/{{ COMPOSER_COMMIT }}"
enabled: yes
gpgcheck: no
priority: "5"
- name: Add osbuild repository
tags:
- ci
- fedora
yum_repository:
name: "osbuild"
description: "osbuild commit {{ osbuild_commit }}"
baseurl: "http://osbuild-composer-repos.s3-website.us-east-2.amazonaws.com/osbuild/{{ rpmrepo_distribution }}/{{ ansible_architecture }}/{{ osbuild_commit }}"
enabled: yes
gpgcheck: no
priority: "5"
# if osbuild_commit is not defined, osbuild from distribution repositories is installed
when: osbuild_commit is defined
- name: Upgrade all packages
tags:
- always
shell: |
sudo dnf -y update
register: result
retries: 5
until: result is success
- name: Add Vector repo
tags:
- always
copy:
src: "{{ playbook_dir }}/roles/common/files/timber-vector.repo"
dest: /etc/yum.repos.d/
- name: Install required packages
tags:
- always
shell: |
sudo dnf -y install jq unzip vector
register: result
retries: 5
until: result is success
- name: Download AWS CLI installer
tags:
- always
get_url:
url: "https://awscli.amazonaws.com/awscli-exe-linux-{{ ansible_architecture }}.zip"
dest: /tmp/awscli.zip
register: result
retries: 5
until: result is success
- name: Unpack AWS CLI installer
tags:
- always
unarchive:
src: /tmp/awscli.zip
dest: /tmp
remote_src: yes
- name: Run AWS installer
tags:
- always
command: /tmp/aws/install
- name: Cleanup AWS installer
tags:
- always
file:
path: "{{ item }}"
state: absent
loop:
- /tmp/awscli.zip
- /tmp/aws
- name: Create rpmbuild directory
tags:
- rhel
file:
path: "{{ item }}"
state: directory
with_items:
- /tmp/rpmbuild
- /tmp/rpmbuild/RPMS
- name: Push rpms
tags:
- rhel
ansible.posix.synchronize:
mode: push
src: "{{ playbook_dir }}/roles/common/files/rpmbuild/{{ ansible_architecture }}/RPMS"
dest: /tmp/rpmbuild
- name: Add repo config
tags:
- rhel
copy:
dest: /etc/yum.repos.d/osbuild.repo
content: |
[osbuild]
name=osbuild
baseurl=file:///tmp/rpmbuild/RPMS
enabled=1
gpgcheck=0
priority=1
- name: Install worker rpm
tags:
- ci
- rhel
shell: |
sudo dnf -y install osbuild-composer-worker
- name: Install worker rpm from copr
tags:
- fedora
shell: |
dnf copr enable -y @osbuild/osbuild-composer
COMPOSER_COMMIT_SHORT=$(echo {{ COMPOSER_COMMIT }} | head -c 9)
COMPOSER_RPMS=$(dnf search -q --showduplicates osbuild-composer | grep -E "osbuild-composer-worker-[0-9]+.*g$COMPOSER_COMMIT_SHORT.*{{ ansible_architecture }}" | cut -f 1 -d ':')
if [ -z $COMPOSER_RPMS ]; then
echo $COMPOSER_COMMIT_SHORT worker rpms not available for on @osbuild/osbuild-composer copr
exit 1
fi
echo "installing rpms $COMPOSER_RPMS"
dnf install -y $COMPOSER_RPMS
- name: Cleanup rpmbuild dir
tags:
- always
file:
path: "{{ item }}"
state: absent
with_items:
- /tmp/rpmbuild
- /etc/yum.repos.d/osbuild.repo