Salt Generate Keys For Minion

  
  • SaltStack Tutorial
  • SaltStack Useful Resources
  • Selected Reading

Nov 08, 2014  Summary: Minion will generate two minion keys under certain race conditions, which results in salt-minion with a key that will never work until you delete and re-add the key on salt-master. Description: If you start salt-minion and run a. Preseeding keys is the recommended way to handle provisioning using a master. On a machine with salt installed, run salt-key -gen-keys=minionid to generate the necessary.pub and.pem files. For an example of a more advanced setup, look at the original plugin.

  • Now that the master can be found, Start and Enable the salt-minion service. Or to run in debug mode # salt-minion -l debug Salt Key. Salt authenticates minion using public key encryption and authentication. For a minion to start accepting commands from the master the minion keys need to be accepted. The salt-key command is used to manage all of.
  • Salt-minion not generating keys in sles 12 sp2 Showing 1-8 of 8 messages. Salt-minion not generating keys in sles 12 sp2: dhanasekar n: 10/4/17 4:22 AM Team, I have an issue in.

Salt executes commands in a remote system by using salt-minion. This is the normal behavior. In some scenarios, the remote system can be accessed only by the SSH protocol. For these scenarios, Salt provides an option to connect the remote system using the SSH protocol only and execute the command through the SSH layer.

Salt SSH is very easy to configure. The only needed configuration is to specify the remote system details in a special file called as the Roster file. This roster file is normally located in /etc/salt/roster. The roster file will have all the information regarding the remote system and how can we connect to it. Once the roster files are configured, all the Salt commands are executed using the salt-ssh instead of the salt command.

Roster File

The Roster System is designed specifically for Salt SSH. This is designed as a pluggable system. The sole purpose of the roster system is to gather information about the remote system. The roster file is a YAML based configuration file containing remote system information as targets. These targets are a special data structure with a predefined set of attributes. A roster file contains one or more targets and each target is identified by a Salt ID.

The basic structure of the roster file is as follows −

All the other attributes supported by the roster file is optional. They are as follows − /openssl-generate-rsa-key-pair-pem.html.

  • port − SSH port number.

  • sudo − whether to run the command via sudo.

  • sudo_user − sudo user name.

  • tty − true if sudo is enabled.

  • priv − private key.

  • timeout − timeout for an SSH connection.

  • minion_opts − dictionary of minion opts.

  • thin_dir − target system's storage directory for salt components.

  • cmd_umask − umask to force for the salt-call command.

The sample roster file is as follows −

Deploy SSH Keys

Salt SSH will generate a default public/private key pairs for SSH logins. The default path will be /etc/salt/pki/master/ssh/salt-ssh.rsa. This key can be deployed to the remote system using the ssh-copy-id command as shown below.

Execute Command

Executing a salt command is as simple as changing the salt cli command into salt-ssh as shown below.

Raw Shell Command

Salt SSH provides an option (-r) to execute a raw command in the remote system bypassing the salt module and functions.

Targeting with Salt SSH

Targeting the remote system in Salt SSH supports only glob and regex targets. Since Salt SSH is a separate module, it provides only limited options as of now and will provide more features in the near future.

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Don't show systemctl commands. (Discuss in Talk:Saltstack#)

From docs.saltstack.com:

Salt is a new approach to infrastructure management. Easy enough to get running in minutes, scalable enough to manage tens of thousands of servers, and fast enough to communicate with them in seconds.
Salt delivers a dynamic communication bus for instrastructures that can be used for orchestration, remote execution, configuration management and much more.
  • 2Components of Salt Stack
  • 4Salt States

Installation

Install the salt package.

Components of Salt Stack

Salt is at its core a Remote Execution solution. Running pre-defined or arbitrary commands on remote hosts. Salt functions on a master/minion topology. A master server acts as a central control bus for the clients (called minions), and the minions connect back to the master.

Salt Master

The default configuration is suitable for the vast majority of installations. Start and Enable the salt-master service.

The Salt master can also be started in the foreground in debug mode, greatly increasing the command output:

The Salt master needs to bind to 2 TCP network ports on the system, these ports are 4505 and 4506.

Salt Minion

The Salt Minion can operate with or without a Salt Master. This wiki assumes that the minion will be connected to the master. For information on how to run a master-less minion please see the masterless quickstart guide: http://docs.saltstack.com/topics/tutorials/quickstart.html

The Salt minion only needs to be aware of one piece of information to run, the network location of the master. By default the minion will look for the DNS name salt for the master, making the easiest approach to set internal DNS to resolve the name salt back to the Salt Master IP. Otherwise the minion configuration file will need to be edited, edit the configuration option master to point to the DNS name or the IP of the Salt Master.

Now that the master can be found, Start and Enable the salt-minion service.

Or to run in debug mode

Salt Key

Salt Generate Keys For Minion 2017

Salt authenticates minion using public key encryption and authentication. For a minion to start accepting commands from the master the minion keys need to be accepted. The salt-key command is used to manage all of the keys on the master. To list the keys that are on the master run salt-key list command:

The keys that have been rejected, accepted and pending acceptance are listed. To accept a minion:

Or you can accept all keys at once with :

Salt Cloud

Salt can also be used to provision cloud servers on most major cloud providers. In order to connect to these providers, additional dependencies may be required. python2-apache-libcloud[broken link: package not found] is required for many popular providers such as Rackspace and Amazon, and can be found in the community repositories. Further details for configuring your cloud provider can be found at the official wiki: http://docs.saltstack.com/en/latest/topics/cloud/

Salt commands

After connecting and accepting the minion on the Salt master you can now send commands to the minion. Salt commands allow for a vast set of functions to be executed and for specific minion and groups of minions to be targeted for execution. This makes the salt command very powerful, but the command is also very usable, and easy to understand.

The salt command is compromised of command options, target specification, the function to execute, and arguments to the function. A simple command to start with looks like this:

The * is the target, which specifies all minions, and test.ping tells the minions to run the test.ping function. This salt command will tell all of the minions to execute the test.ping in parallel and return the result.

For more commands see documentation or run:

Salt States

Salt Generate Keys For Minion Video

In addition to running commands, salt can use what are known as states. A state is like a configuration file that allows setting up a new installation in the exact same way. A state can also be ran on that install after several weeks to make sure the computer is still in a known configuration.

Salt Environments

States can be separated into different environments. These environments can be used for making changes in a test environment before moving to a production machine, configuring a group of servers the same way, etc. The base environment is /srv/salt by default, and sometimes /srv/salt must be manually created.

Different environments can be set up in the salt-master file. Check /etc/salt/master for more info.

Creating a State

A state is a text file ending in *.sls located within a configured environment. This assumes the only the default base environment set up.

Create a file in /srv/salt called test.sls.

Add the following to the file:

Salt generate keys for minion free

Now run the state:

Salt will search the base environment folder for anything called test.sls and apply the configuration it finds to all servers. In this case, netcat will be installed on all servers.

For more information on state file syntax and using states, see here: https://docs.saltstack.com/en/latest/topics/tutorials/starting_states.html Nitro pro 9 key generator download.

The top file

The top file is the main way to apply different configs to different servers at once. The top file is called top.sls and is placed in the root of an environment. The top file configuration can be ran with the following command.

Let us assume we have 2 servers: fs01, web01. Let's also assume we have 3 states in the base environment: nettools.sls, samba.sls, apache.sls. Here is a sample top file.

When state.apply is ran, the top file is read, and the states are applied to the correct servers. IE: nettools on all servers, samba on fs01, apache on web01.

Scheduling Tasks

Enable the salt scheduler on the minion with

and Installpython2-dateutil on the master and any minions that will be using the scheduler and restart the salt-minion service on that server. Remember, you can easily install python2-dateutil and restart the salt-minion service on all minions using a state or a salt '*' command.

Assume samba.sls, stored in /srv/salt, needs to be run every Monday on fs01. This can be accomplished by placing the following into a state file and running it.

Run

Salt Minion Download

to verify the job was placed on the schedule.


A point to note. In the config file above, specifying state.sls for the function is how you specify job_args is receiving a state called samba. Do NOT try substituting state.sls with samba.sls or any other sls file. Function simply tells the scheduler how to treat jobs_args.

For more details on configuring schedules, see https://docs.saltstack.com/en/latest/ref/states/all/salt.states.schedule.html

See also

  • http://docs.saltstack.com/ - Official documentation

Salt Generate Keys For Minion 2017

Retrieved from 'https://wiki.archlinux.org/index.php?title=Saltstack&oldid=584260'