salt.runners.manage

General management functions for salt, tools like seeing what hosts are up and what hosts are down

salt.runners.manage.alived(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.alived
salt.runners.manage.allowed(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.allowed
salt.runners.manage.bootstrap(version='develop', script=None, hosts='', root_user=False, script_args='', roster='flat', ssh_user=None, ssh_password=None, ssh_priv_key=None, tmp_dir='/tmp/.bootstrap', http_backend='tornado')

Bootstrap minions with salt-bootstrap

version : develop
Git tag of version to install
script : https://bootstrap.saltstack.com
URL containing the script to execute
hosts
Comma-separated hosts [example: hosts='host1.local,host2.local']. These hosts need to exist in the specified roster.
root_user : False

Prepend root@ to each host. Default changed in Salt Carbon from True to False.

在 Carbon 版更改.

Oxygen 版后已移除.

script_args

Any additional arguments that you want to pass to the script.

Carbon 新版功能.

roster : flat

The roster to use for Salt SSH. More information about roster files can be found in Salt's Roster Documentation.

A full list of roster types, see the builtin roster modules documentation.

Carbon 新版功能.

ssh_user

If user isn't found in the roster, a default SSH user can be set here. Keep in mind that ssh_user will not override the roster user value if it is already defined.

Carbon 新版功能.

ssh_password

If passwd isn't found in the roster, a default SSH password can be set here. Keep in mind that ssh_password will not override the roster passwd value if it is already defined.

Carbon 新版功能.

ssh_privkey

If priv isn't found in the roster, a default SSH private key can be set here. Keep in mind that ssh_password will not override the roster passwd value if it is already defined.

Carbon 新版功能.

tmp_dir : /tmp/.bootstrap

The temporary directory to download the bootstrap script in. This directory will have -<uuid4> appended to it. For example: /tmp/.bootstrap-a19a728e-d40a-4801-aba9-d00655c143a7/

Carbon 新版功能.

http_backend : tornado

The backend library to use to download the script. If you need to use a file:/// URL, then you should set this to urllib2.

Carbon 新版功能.

CLI 范例:

salt-run manage.bootstrap hosts='host1,host2'
salt-run manage.bootstrap hosts='host1,host2' version='v0.17'
salt-run manage.bootstrap hosts='host1,host2' version='v0.17'             script='https://bootstrap.saltstack.com/develop'
salt-run manage.bootstrap hosts='ec2-user@host1,ec2-user@host2'             root_user=False
salt.runners.manage.bootstrap_psexec(hosts='', master=None, version=None, arch='win32', installer_url=None, username=None, password=None)

Bootstrap Windows minions via PsExec.

hosts
Comma separated list of hosts to deploy the Windows Salt minion.
master
Address of the Salt master passed as an argument to the installer.
version
Point release of installer to download. Defaults to the most recent.
arch
Architecture of installer to download. Defaults to win32.
installer_url
URL of minion installer executable. Defaults to the latest version from https://repo.saltstack.com/windows/
username
Optional user name for login on remote computer.
password
Password for optional username. If omitted, PsExec will prompt for one to be entered for each host.

CLI 范例:

salt-run manage.bootstrap_psexec hosts='host1,host2'
salt-run manage.bootstrap_psexec hosts='host1,host2' version='0.17' username='DOMAIN\Administrator'
salt-run manage.bootstrap_psexec hosts='host1,host2' installer_url='http://exampledomain/salt-installer.exe'
salt.runners.manage.down(removekeys=False)

Print a list of all the down or unresponsive salt minions Optionally remove keys of down minions

CLI 范例:

salt-run manage.down
salt-run manage.down removekeys=True
salt.runners.manage.get_stats(estate=None, stack='road')

Print the stack stats

estate : None
The name of the target estate. Master stats would be requested by default
stack : 'road'
Show stats on either road or lane stack Allowed values are 'road' or 'lane'.

CLI 范例:

salt-run manage.get_stats [estate=alpha_minion] [stack=lane]
salt.runners.manage.joined(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.joined
salt.runners.manage.key_regen()

This routine is used to regenerate all keys in an environment. This is invasive! ALL KEYS IN THE SALT ENVIRONMENT WILL BE REGENERATED!!

The key_regen routine sends a command out to minions to revoke the master key and remove all minion keys, it then removes all keys from the master and prompts the user to restart the master. The minions will all reconnect and keys will be placed in pending.

After the master is restarted and minion keys are in the pending directory execute a salt-key -A command to accept the regenerated minion keys.

The master must be restarted within 60 seconds of running this command or the minions will think there is something wrong with the keys and abort.

Only Execute this runner after upgrading minions and master to 0.15.1 or higher!

CLI 范例:

salt-run manage.key_regen
salt.runners.manage.lane_stats(estate=None)

Print the estate manor lane stack stats

estate : None
The name of the target estate. Master stats would be requested by default

CLI 范例:

salt-run manage.lane_stats [estate=alpha_minion]
salt.runners.manage.list_not_state(subset=None, show_ipv4=False, state=None)

2015.8.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.
state : 'available'
Show minions being in specific state that is one of 'available', 'joined', 'allowed', 'alived' or 'reaped'.

CLI 范例:

salt-run manage.list_not_state
salt.runners.manage.list_state(subset=None, show_ipv4=False, state=None)

2015.8.0 新版功能.

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.
state : 'available'
Show minions being in specific state that is one of 'available', 'joined', 'allowed', 'alived' or 'reaped'.

CLI 范例:

salt-run manage.list_state
salt.runners.manage.not_alived(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.not_alived
salt.runners.manage.not_allowed(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.not_allowed
salt.runners.manage.not_joined(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.not_joined
salt.runners.manage.not_present(subset=None, show_ipv4=False)

2015.5.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.not_present
salt.runners.manage.not_reaped(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are NOT up according to Salt's presence detection (no commands will be sent)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.not_reaped
salt.runners.manage.present(subset=None, show_ipv4=False)

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.present
salt.runners.manage.reaped(subset=None, show_ipv4=False)

2015.8.0 新版功能.

Print a list of all minions that are up according to Salt's presence detection (no commands will be sent to minions)

subset : None
Pass in a CIDR range to filter minions by IP address.
show_ipv4 : False
Also show the IP address each minion is connecting from.

CLI 范例:

salt-run manage.reaped
salt.runners.manage.road_stats(estate=None)

Print the estate road stack stats

estate : None
The name of the target estate. Master stats would be requested by default

CLI 范例:

salt-run manage.road_stats [estate=alpha_minion]
salt.runners.manage.safe_accept(target, expr_form='glob')

Accept a minion's public key after checking the fingerprint over salt-ssh

CLI 范例:

salt-run manage.safe_accept my_minion
salt-run manage.safe_accept minion1,minion2 expr_form=list
salt.runners.manage.status(output=True)

Print the status of all known salt minions

CLI 范例:

salt-run manage.status
salt.runners.manage.up()

Print a list of all of the minions that are up

CLI 范例:

salt-run manage.up
salt.runners.manage.versions()

Check the version of active minions

CLI 范例:

salt-run manage.versions