[CentOS-devel] releasever does not contain variant as expected

Wed Dec 8 09:31:25 UTC 2021
Fabian Arrotin <arrfab at centos.org>

On 08/12/2021 10:00, Marc Dequènes (Duck) wrote:
> Quack,
> 
> (this is a post I made for centos@ on 2021-10-27 and that never made it 
> on the list for some unknown reason; retrying here since it's still 
> current)
> 
> I'm trying to install CentOS Stream directly without switching from 
> Linux to Stream in our automated install. The changes were 
> straightforward but I was very surprised to get CentOS Linux instead of 
> the expected CentOS Stream.
> 
> I captured the virt-install call to check if there was any mistake and 
> that's fine:
> virt-install -n taiste.osci.io --memory=2048,maxmemory=4096 --memballoon 
> virtio --disk bus=virtio,path=/dev/vg_Spritz/taiste.osci.io 
> --vcpus=1,maxvcpus=2 
> --initrd-inject=/etc/libvirt/kickstarts/taiste.osci.io/ks.cfg 
> --autostart --noautoconsole --watchdog default --arch x86_64 -l 
> http://mirror.rackspace.com/CentOS/8-stream/BaseOS/x86_64/os/ --network 
> bridge=virbr0,model=virtio --graphics none -x 'net.ifnames=0 
> inst.ks=file:/ks.cfg ks=file:/ks.cfg console=tty0 console=ttyS0'
> 
> Our kickstart (ks.cfg) contains:
>   url 
> --mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS 
> 
> and that has worked for ages.
> 
> Digging deeper I found out $releasever only contains the major version 
> without the variant (like "6Server" on RHEL for eg).
> 
> DNF is using a new variable $stream that breaks compatibility with the 
> past and AFAIK is only available through DNF (but I can't use it in the 
> kickstart for all versions anyway).
> 
> Since we're using Ansible I can work around that but I was wondering if 
> there was any way to handle this better in a retro-compatible way.
> 
> Regards.
> \_o<
> 

Well, I think it was already discussed multiple times on this list but 
yeah, $releasever is and will remain the corresponding version so 
8-stream will answer 8 and 9-stream will answer 9. Stream uses another 
yum/dnf variable called "stream" :

See on a 8-stream :

cat /etc/yum/vars/stream
8-stream

grep mirrorlist /etc/yum.repos.d/CentOS-Stream-BaseOS.repo
mirrorlist=http://mirrorlist.centos.org/?release=$stream&arch=$basearch&repo=BaseOS&infra=$infra

That's the reason why even for CentOS Infra we have a specific {{ 
centos_version }} declared in our ansible inventories that was 8 and now 
by default is 8-stream for the kickstart we use :

https://github.com/CentOS/ansible-infra-playbooks/blob/master/templates/kickstarts/centos-8-ks.cfg.j2#L6


-- 
Fabian Arrotin
The CentOS Project | https://www.centos.org
gpg key: 17F3B7A1 | twitter: @arrfab
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20211208/c8e3510e/attachment-0004.sig>