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 code repositories with Git


In modern dynamic environments, usage of code repositories is considered vital for efficient code management, collaboration, and practices such as Continuous Integration. Fortunately, Salt makes it easy enough to manage code repositories using its modules. In this recipe, you will learn how to manage code repositories using Git.

How to do it...

We will use the same minion and state directory as the previous recipe:

  1. Create and edit the /opt/salt-cookbook/staging/apache/git_repo.sls file to have the following entries:

    git:
      pkg:
        - installed
      user:
        - present
        - home: /home/git
    
    /opt/apache-repo:
      file.directory:
        - user: git
        - group: git
        - dir_mode: 0755
        - require:
          - user: git
    
    /home/git/.ssh:
      file.directory:
        - user: git
        - group: git
        - dir_mode: 775
        - require:
          - user: git
    
    git-key:
      file.managed:
        - name: /home/git/.ssh/id_rsa
        - source: salt://apache/keys/id_rsa
        - user: git
        - group: git...