Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

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:

  1. Create a new state directory called pkg_repo in the staging environment.

  2. 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/epel/6/$bas earch"
        - gpgcheck...