Q: Using both baseurl and mirrorlist in yum.repo I want to cache RPM packets in my Nexus Repository. In repo file on client side I have two lines, both uncommented:
baseurl=http://nexus-ip/repository/bts-nexus-almalinux-base/$releasever/BaseOS/$basearch/os/
mirrorlist=https://mirrors.almalinux.org/mirrorlist/$releasever/baseos

Yum updates goes only to mirrorlist. If I comment mirrorlist, then everything working fine, but if nexus repo unavailable, then servers can't update packets. What I want in the end, that client goes first to baseurl and only if it's unavailable, uses mirrorlist. Is it possible? How can I prioritise baseurl over mirrorlist?

A: mirrorlist is just to give you more alternatives to download packages, from doc.

mirrorlist Specifies a URL to a file containing a list of baseurls.
This can be used instead of or with the baseurl option. Substitution
variables, described below, can be used with this option. As a special
hack is the mirrorlist URL contains the word "metalink" then the value
of mirrorlist is copied to metalink (if metalink is not set).

So you can put same baseurl in top of the mirrorlist and survive only with mirrorlist incase some packages are not part of baseurl url.
Edit 1:
You can try baseurl and failovermethod=priority combination, add urls based in priority you want in similar sequence.

failovermethod
It can be 'roundrobin' or 'priority'. 'roundrobin' randomly selects a URL from the list of URLs to start and then if it
failes to contact the selected server it proceed with another selected
similarly. 'priority' starts from the first one listed in baseurl and
if it fails to contact the server, it continues sequentially with the
next in the list. If not specified, the default is 'priority'.It can be 'roundrobin' or 'priority'. 'roundrobin'

You can give multiple baseurl like below,
baseurl=http://<service_node>/install/centos7.5/x86_64         
        http://<master_node>/install/centos7.5/x86_64

