- name: Build the RPMS hosts: all tasks: - name: Install EPEL release package become: true ansible.builtin.dnf: name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm state: present disable_gpg_check: true - name: Install software become: true ansible.builtin.dnf: name: - git - rpm-build - rpmdevtools - rpmrebuild state: present - name: Install rpmrebuild become: true ansible.builtin.yum: name: rpmrebuild state: present - name: Clear directory $HOME/rpmbuild ansible.builtin.file: path: "{{ ansible_env.HOME }}/rpmbuild" state: absent - name: Clear symbolic link between ansible.builtin.file: src: "{{ ansible_env.HOME }}/red-hat-kiosk/rpms" dest: "{{ ansible_env.HOME }}/rpmbuild" state: link - name: Build the kiosk-config RPMS ansible.builtin.shell: spectool -g -R $HOME/rpmbuild/SPECS/kiosk-config.spec | rpmbuild -ba $HOME/rpmbuild/SPECS/kiosk-config.spec - name: Build the microshift-manifests RPM ansible.builtin.shell: spectool -g -R $HOME/rpmbuild/SPECS/microshift-manifests.spec | rpmbuild -ba $HOME/rpmbuild/SPECS/microshift-manifests.spec - name: Ensure the VENDOR directory exists ansible.builtin.file: path: "{{ ansible_env.HOME }}/rpmbuild/VENDOR" state: directory mode: '0755' - name: Download Google Chrome RPM ansible.builtin.get_url: url: https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm dest: "{{ ansible_env.HOME }}/rpmbuild/VENDOR/google-chrome-stable_current_x86_64.rpm" - name: Rebuild the Google Chrome RPM ansible.builtin.shell: | set -Eeuo pipefail rpmrebuild -s {{ ansible_env.HOME }}/rpmbuild/SPECS/google-chrome-stable.spec -p {{ ansible_env.HOME }}/rpmbuild/VENDOR/google-chrome-stable_current_x86_64.rpm RPM=$(rpm -q {{ ansible_env.HOME }}/rpmbuild/VENDOR/google-chrome-stable_current_x86_64.rpm) mkdir -p {{ ansible_env.HOME }}/rpmbuild/BUILDROOT/$RPM/ rpm2cpio {{ ansible_env.HOME }}/rpmbuild/VENDOR/google-chrome-stable_current_x86_64.rpm | cpio -idmv -D {{ ansible_env.HOME }}/rpmbuild/BUILDROOT/$RPM/ mv {{ ansible_env.HOME }}/rpmbuild/BUILDROOT/$RPM/opt/google/ {{ ansible_env.HOME }}/rpmbuild/BUILDROOT/$RPM/usr/bin/ cd {{ ansible_env.HOME }}/rpmbuild/BUILDROOT/$RPM/usr/bin/ rm -f google-chrome-stable ln -s google/chrome/google-chrome google-chrome-stable ln -s google/chrome/google-chrome chrome sed -i.${EPOCHREALTIME:-bak} 's|/opt/google|/usr/bin/google|g' {{ ansible_env.HOME }}/rpmbuild/SPECS/google-chrome-stable.spec rpmbuild -bb {{ ansible_env.HOME }}/rpmbuild/SPECS/google-chrome-stable.spec args: executable: /bin/bash register: rebuild_result failed_when: rebuild_result.rc != 0 - name: Get build RMPS ansible.builtin.find: path: "{{ ansible_env.HOME }}/rpmbuild/RPMS/x86_64/" register: build_rpms - name: Extract filenames from paths of built RPMs ansible.builtin.set_fact: rpm_filenames: "{{ build_rpms.files | map(attribute='path') | map('basename') | list }}" - name: List build RMPS ansible.builtin.debug: msg: "{{ rpm_filenames }}"