Managing package repositories
Managing packages is an extremely important and base requirement of infrastructure management. However, to manage packages, we need proper package repositories configured. In this chapter, you will learn about how to efficiently manage package repositories with Salt.
How to do it...
Configure two new minions called salt-minion-centos
(with OS as CentOS) and salt-minion-ubuntu
(with OS as Ubuntu). Configure the environment
grain with the value of staging environment in both the minions:
- Create a new state directory called
pkg_repo
in the staging environment. - Create and edit
/opt/salt-cookbook/staging/pkg_repo/init.sls
to have the following entries:salt-repo: pkgrepo.managed: {% if grains['lsb_distrib_id'] == "CentOS" %} - humanname: CentOS-$releasever - Epel Repo - mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel- 6&arch=$basearch - comments: - "#baseurl=http://download.fedoraproject.org/pub...