From 6b677313e94bf2e664ce6fb8d0133178b7843572 Mon Sep 17 00:00:00 2001 From: Kevin Fenzi Date: Tue, 17 May 2022 08:44:20 -0700 Subject: [PATCH] batcave: setup for rhel9 syncing Signed-off-by: Kevin Fenzi --- roles/batcave/files/rhel9-sync | 69 ++++++++++++++++++++++++++++++++++ roles/batcave/files/sync-rhn | 1 + roles/batcave/tasks/main.yml | 10 +++++ 3 files changed, 80 insertions(+) create mode 100644 roles/batcave/files/rhel9-sync diff --git a/roles/batcave/files/rhel9-sync b/roles/batcave/files/rhel9-sync new file mode 100644 index 0000000000..6e0d70c9ff --- /dev/null +++ b/roles/batcave/files/rhel9-sync @@ -0,0 +1,69 @@ +#!/bin/sh + +## +# Setup the directories we will sync down to. +RHEL9SYNCDIR=/srv/web/repo/rhel/rhel9 +SYNCDIR=/var/cache/reposync/ + +## +# Need to download the metadata and the modular data +DNFOPTS='--download-metadata -m --setopt=module_platform_id="platform:el9"' +# Need to set the arches we are going to sync down +ARCHES="aarch64 ppc64le s390x x86_64" + + +## +# Do the deeds +cd ${RHEL9SYNCDIR} + +# Make the sync dir where dnf will drop stuff. This disappeared once +# and caused the script to die so we do this explicitely now. +mkdir -vp ${SYNCDIR} + +## +## Sync Out RHEL-9 for appropriate arches +for A in ${ARCHES}; do + + # In case we have a bad sync from before, make sure the old sync + # data is destroyed. + rm -rf ${SYNCDIR}/${A} + + # Configuration files for yum4 should fit this pattern. + CONF=yum4-batcave-rhel9-${A}.conf + + # Setup the repos you are going to sync out of the config file in + # this pattern. This makes it easier for koji configs later + REPOS="rhel-9-for-${A}-appstream-rpms rhel-9-for-${A}-baseos-rpms codeready-builder-for-rhel-9-${A}-rpms" + + # We do a 2 level reposync because batcave is RHEL-7 and reposync + # is what is default. However reposync does not pull in certain + # data so we have to repeat this with dnf to get the metadata + # needed for modularity. + for R in ${REPOS}; do + echo "Syncing ${R} for ${A}" + # Be verbose on errors. + if [[ $? -ne 0 ]]; then + echo "Something went wrong with reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -a noarch -p ${A}" + fi + # x86_64 is 'special' because we have to tell it for i686 also. + if [[ ${A} == 'x86_64' ]]; then + dnf reposync -c ${RHEL8SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -a i686 -p ${A} &> /dev/null + else + dnf reposync -c ${RHEL8SYNCDIR}/${CONF} ${DNFOPTS} --repoid=${R} -a ${A} -a noarch -p ${A} &> /dev/null + fi + if [[ $? -ne 0 ]]; then + echo "Something went wrong with dnf reposync -c ${RHEL8SYNCDIR}/${CONF} --repoid ${R} -a ${A} -p ${A}" + fi + done +done + +### Here we put in syncs which do not fit in with the general do this +### for all architectures. In this case we only copy down openstack +### for x86_64 and source because we really only care about rabbitmq +### We put this in an 'other' directory so that grobisplitter and any +### other tools don't accidently pull it into their work. + +OTHERCONF=yum4-batcave-rhel9-other.conf + +#dnf reposync -c ${RHEL8SYNCDIR}/${OTHERCONF} ${DNFOPTS} --repoid rhel-8-x86_64-openstack-16-rpms -a x86_64 -a noarch -a i686 -p other &> /dev/null +#dnf reposync -c ${RHEL8SYNCDIR}/${OTHERCONF} ${DNFOPTS} --repoid rhel-8-srpms-openstack-16-rpms --source -a x86_64 -a noarch -a i686 -p other &> /dev/null diff --git a/roles/batcave/files/sync-rhn b/roles/batcave/files/sync-rhn index 358c27e5fa..f7fbde1cd3 100644 --- a/roles/batcave/files/sync-rhn +++ b/roles/batcave/files/sync-rhn @@ -1,2 +1,3 @@ 30 1 * * * root /mnt/fedora/app/fi-repo/rhel/rhel7/rhel7-sync > /dev/null 30 3 * * * root /mnt/fedora/app/fi-repo/rhel/rhel8/rhel8-sync > /dev/null +30 5 * * * root /mnt/fedora/app/fi-repo/rhel/rhel9/rhel9-sync > /dev/null diff --git a/roles/batcave/tasks/main.yml b/roles/batcave/tasks/main.yml index a90c57eb80..3660e31a57 100644 --- a/roles/batcave/tasks/main.yml +++ b/roles/batcave/tasks/main.yml @@ -284,6 +284,16 @@ - batcave - config when: inventory_hostname.startswith('batcave01') +# +# Setup rhel9 sync script. +# + +- name: setup rhel9 sync copy script + copy: src=rhel9-sync dest=/mnt/fedora/app/fi-repo/rhel/rhel9/rhel9-sync mode=0775 + tags: + - batcave + - config + when: inventory_hostname.startswith('batcave01') # # sync-rhn cron job