This article was originally published on the Red Hat Customer Portal. The information may no longer be current.
In any modern development environment automation is crucial. For Red Hat flavoured OS'es, application management typically is based on RPM packages. Bringing automation into an RPM development environment sooner or later leads to Mock https://fedorahosted.org/mock/.
With Satellite-6, Mock has finally a capable life cycle management counterpart. In large projects with several teams working on interdependent components, Satellite Content Views (CVs) are powerful means to provide a solid baseline for development and change management.
In essence, Mock is creating a chroot
environment for building RPM packages. Ideally, this should be independent of the architecture and release version of the build host. However, content distribution via Satellite is bound to subscriptions. To achieve releasever independence with Satellite-6, we have two options: we either broaden the content scope available to the build host or we use dedicated subscriptions for different Mock targets.
The first is possible with Satellite-6 because other than Satellite-5 it has no notion of a base channel. There is no limitation to create CVs with both RHEL-6 and RHEL-7 repos side by side. It is also possible to subscribe a host directly to Library, omitting all life cycle management via CVs.
To implement subscription based content distribution, Satellite-6 is using SSL client certs to authenticate and authorize access to the various repos. Each CV embraces one or more repos for distribution in certain life cycle environments (LCE) for a particular organization. The baseurl
for these repos is encoding organization, LCE and CV in addition to releasever and architecture. The SSL client certs associated with a hosts subscription grant access only to one particular CV/LCE combination for each enabled repo.
For example, the baseurl
http://sat.example.com/pulp/repos/Default_Org/Production/RHEL_7_Baseline/content/dist/rhel/server/7/7Server/$basearch/os
requires a subscription for the RHEL 7 Baseline Content View in stage Production belonging to the Default Org. Only if the SSL client cert provides this subscription access to the repo is granted.
Configuring Mock to use Satellite-6 boils down to providing the correct SSL client certs for the required repos. As mentioned above, we can achieve this by either customizing the build host CV to contain all required repos or by giving Mock more than one subscription (taken from other template host).
The following facts need to be observed to acomplish the goal:
- The SSL client certs and associated keys belonging to a subscription are stored in
/etc/pki/entitlement/
. - The SSL server cert is always signed with
/etc/rhsm/ca/katello-server-ca.pem
. - The yum.repo setup for a Satellite-6 host is configured in
/etc/yum.repos.d/redhat.repo
.
Bringing these three together makes up a proper Mock configuration.
To make the certs available to Mock, we bind mount /etc/pki/entitlement/
and /etc/rhsm/ca/
into the chroot
.
The according configuration settings
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/etc/pki/entitlement', '/etc/pki/entitlement/' ))
config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/etc/rhsm/ca/', '/etc/rhsm/ca/' ))
can either be added to /etc/mock/site-defaults.cfg
or to a particular chroot
configuration.
If you use multiple subscriptions from template hosts you can either copy the SSL client certs to the /etc/pki/entitlement/
of the build host or you bind mount a different directory that holds a collection of all required certs.
The chroot
configuration finally must include the appropriate baseurl/client cert combinations for the required repos. The easiest way to get this repo definition is by enabling it on the build- or template-host and copying the appropriate section from /etc/yum.repos.d/redhat.repo
.
The resulting /etc/mock/rhel-7-x86_64.cfg
should look similar to this:
config_opts['root'] = 'rhel-7-x86_64'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64',)
config_opts['chroot_setup_cmd'] = 'install bash bzip2 cpio diffutils gzip perl sed tar unzip which @development'
config_opts['dist'] = 'el7'
config_opts['releasever'] = '7Server'
config_opts['yum.conf'] = """
[main]
cachedir=/var/cache/yum
keepcache=1
debuglevel=1
reposdir=/dev/null
logfile=/var/log/yum.log
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
# repos
[rhel-7-server-rpms]
name = Red Hat Enterprise Linux 7 Server (RPMs)
enabled = 1
baseurl = https://sat.example.com/pulp/repos/Default_Org/Production/RHEL_7_Baseline/content/dist/rhel/server/7/7Server/$basearch/os
ui_repoid_vars = basearch
metadata_expire = 1
sslverify = 1
sslclientkey = /etc/pki/entitlement/3132072779642053123-key.pem
sslclientcert = /etc/pki/entitlement/3132072779642053123.pem
sslcacert = /etc/rhsm/ca/katello-server-ca.pem
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Sobre o autor
Mais como este
Navegue por canal
Automação
Saiba o que há de mais recente nas plataformas de automação incluindo tecnologia, equipes e ambientes
Inteligência artificial
Descubra as atualizações nas plataformas que proporcionam aos clientes executar suas cargas de trabalho de IA em qualquer ambiente
Nuvem híbrida aberta
Veja como construímos um futuro mais flexível com a nuvem híbrida
Segurança
Veja as últimas novidades sobre como reduzimos riscos em ambientes e tecnologias
Edge computing
Saiba quais são as atualizações nas plataformas que simplificam as operações na borda
Infraestrutura
Saiba o que há de mais recente na plataforma Linux empresarial líder mundial
Aplicações
Conheça nossas soluções desenvolvidas para ajudar você a superar os desafios mais complexos de aplicações
Programas originais
Veja as histórias divertidas de criadores e líderes em tecnologia empresarial
Produtos
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Red Hat Cloud Services
- Veja todos os produtos
Ferramentas
- Treinamento e certificação
- Minha conta
- Recursos para desenvolvedores
- Suporte ao cliente
- Calculadora de valor Red Hat
- Red Hat Ecosystem Catalog
- Encontre um parceiro
Experimente, compre, venda
Comunicação
- Contate o setor de vendas
- Fale com o Atendimento ao Cliente
- Contate o setor de treinamento
- Redes sociais
Sobre a Red Hat
A Red Hat é a líder mundial em soluções empresariais open source como Linux, nuvem, containers e Kubernetes. Fornecemos soluções robustas que facilitam o trabalho em diversas plataformas e ambientes, do datacenter principal até a borda da rede.
Selecione um idioma
Red Hat legal and privacy links
- Sobre a Red Hat
- Oportunidades de emprego
- Eventos
- Escritórios
- Fale com a Red Hat
- Blog da Red Hat
- Diversidade, equidade e inclusão
- Cool Stuff Store
- Red Hat Summit