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

Performing SSH authentication tasks


Managing SSH keys and the associated files is a key task that needs to be performed in most infrastructure at present to facilitate a number of functions with remote access between servers. Although this task can be achieved by propagating files to the minions using the file module, Salt has a better way to do it using SSH-specific modules. In this recipe, you will learn how to use these modules.

How to do it...

  1. Configure two minions called salt-minion and backup-server. Configure the server_type grain of salt-minion to have the value app and the backup server's value to be backup.

  2. Create a new state called sshauth, and create two files inside this directory called pubkey.sls and known_hosts.sls. Also create a directory called sshkeys inside the sshauth directory.

    We will assume that the groups and users modules, configured in the last recipe, have been applied on both the minions.

  3. On the salt-minion minion, change to the stg-app user, and run the following...