saltstack实战-6
生活随笔
收集整理的這篇文章主要介紹了
saltstack实战-6
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??
saltstack除了salt命令外還有一些其他命令也可以用來輔助管理客戶端節(jié)點(diǎn),例如:salt-run、salt-key、salt-cp、salt-call、salt-ssh、salt-api
salt-run
????salt-run是一個前端命令,用來執(zhí)行salt runners。salt runners是在master上執(zhí)行的一些簡單的模塊,重點(diǎn)是在master上執(zhí)行的,不是在minion端
--version 打印當(dāng)前運(yùn)行的salt版本 --versions-report 打印程序的依賴性和版本號 -h, --help 查看幫助信息 -c CONFIG_DIR, --config-dir=CONFIG_dir 設(shè)置配置文件的目錄,這個目錄默認(rèn)在master和minion上市通用的。默認(rèn)的配置文件目錄是/etc/salt。 -t TIMEOUT, --timeout=TIMEOUT 等待minion回復(fù)消息的超時時間,超時時間指定了命令行客戶端等待多長時間去向minion查詢并檢查執(zhí)行的job,默認(rèn)是1。 -d, --doc, --documentation 顯示runner的幫助文檔。 -l LOG_LEVEL, --log-level=LOG_LEVEL 設(shè)置日志相關(guān)信息,在命令行設(shè)置的log信息會覆蓋配置文件的日志配置,該參數(shù)設(shè)置在console中顯示的日志級別,主要有以下級別 all, garbage, trace, debug, info, warning, error, quiet. 默認(rèn)是: warning. --log-file=LOG_FILE 設(shè)置日志文件的位置,默認(rèn)是:/var/log/salt/master. --log-file-level=LOG_LEVEL_LOGFILE 該參數(shù)設(shè)置在日志文件中顯示日志的級別,主要有以下級別 all, garbage, trace, debug, info, warning, error, quiet. 默認(rèn)是: warning.
salt-key
salt-key:簡單的管理salt服務(wù)器端的公鑰
-q, --quiet 安靜模式,取消輸出內(nèi)容 -y, --yes 對所問的問題回答yes,默認(rèn)是False --log-file=LOG_FILE 默認(rèn)是 /var/log/salt/minion. --log-file-level=LOG_LEVEL_LOGFILE 該參數(shù)設(shè)置在日志文件中顯示日志的級別,主要有以下級別 all, garbage, trace, debug, info, warning, error, quiet. 默認(rèn)是: warning. --out 替換默認(rèn)的返回數(shù)據(jù)的顯示格式,主要支持以下格式:grains, highstate, json, key, overstatestage, pprint, raw, txt, yaml 如果你的返回數(shù)據(jù)不支持你指定的顯示數(shù)據(jù)的格式,則salt默認(rèn)使用pprint格式 如果你使用 --out=json返回格式,,你可能希望使用--static模式.。如果沒有使用static選項(xiàng),你會在所有的minion客戶端得到JSON字符串,這取決于你是否使用了一個迭代的outputter,所以建議你使用 --static --out-indent OUTPUT_INDENT, --output-indent OUTPUT_INDENT 打值印輸出值中的縮進(jìn), 負(fù)值則禁用縮進(jìn),只適用于支持縮進(jìn)的 outputters --out-file=OUTPUT_FILE, --output-file=OUTPUT_FILE 指定輸出到一個文件 --no-color 不顯示顏色 --force-color 強(qiáng)制顯示顏色 綠色表示成功,紅色表示失敗,藍(lán)色表示有改動,但是成功執(zhí)行,黃色表示配置未來會改變 -l ARG, --list=ARG 列出公鑰,參數(shù) pre, un, 和unaccepted 會列出 unaccepted/unsigned keys, acc oraccepted 會列出accepted/signed keys.,rej or rejected會列出rejected keys,最后, all 列出所有keys -L, --list-all 列出所有的公鑰 -a ACCEPT, --accept=ACCEPT 接受一個指定的客戶端公鑰 -A, --accept-all 接受所有被阻止的客戶端公鑰 -r REJECT, --reject=REJECT 拒絕指定的客戶端公鑰 -R, --reject-all 拒絕所有被阻止的客戶端公鑰 -p PRINT, --print=PRINT 打印指定的客戶端公鑰 -P, --print-all 打印所有的客戶端公鑰 -d DELETE, --delete=DELETE 刪除指定的客戶端公鑰 -D, --delete-all 刪除所有的客戶端公鑰 -f FINGER, --finger=FINGER 打印指定公鑰的指紋 -F, --finger-all 打印所有公鑰的指紋 --gen-keys=GEN_KEYS Set a name to generate a keypair for use with salt --gen-keys-dir=GEN_KEYS_DIR Set the directory to save the generated keypair. Only works with 'gen_keys_dir' option; default is the current directory. --keysize=KEYSIZE Set the keysize for the generated key, only works with the '--gen-keys' option, the key size must be 2048 or higher, otherwise it will be rounded up to 2048. The default is 2048.
salt-cp
????salt-cp:拷貝一個本地文件到所有匹配的minion客戶端
-t TIMEOUT, --timeout=TIMEOUT 超時時間,默認(rèn)是5 -E, --pcre 使用PCRE正則配置minion客戶端 -L, --list 具體列出要拷貝到的minion客戶端名稱 -G, --grain 根據(jù)minion客戶端的grain來區(qū)分拷貝地址 --grain-pcre 使用PCRE正則匹配grain的返回值來確定要拷貝的minion客戶端 -N, --nodegroup 根據(jù)分配的組來確定拷貝地址 -R, --range Instead of using shell globs to evaluate the target, use a range expression to identify targets. Range expressions look like %cluster. Using the Range option requires that a range server is set up and the location of the range server is referenced in the master configuration file.
salt-call
????salt-call:在minion本地運(yùn)行module的功能,而不是在master上遠(yuǎn)程控制minion來運(yùn)行module
-g, --grains 返回grains生成的信息 -m MODULE_DIRS, --module-dirs=MODULE_DIRS 從一個指定的目錄獲取模塊,多個目錄可以用逗號分開 --master=MASTER 設(shè)置一個master,該minion客戶端必須在這個master上經(jīng)過認(rèn)證,如果沒有進(jìn)行設(shè)置,則默認(rèn)會從minion的配置文件中獲取master地址,如果有多個master,則第一個生效 --return RETURNER 設(shè)置salt-call把返回的數(shù)據(jù)發(fā)送到一個或者多個returner接口,如果返回到多個returnners接口,多個接口之間用逗號分隔即可 --local 在本地運(yùn)行salt-call,就好像沒有master在運(yùn)行一樣。
salt-ssh
? ? salt-ssh:允許你使用ssh協(xié)議在客戶端執(zhí)行命名,而不需要安裝master
-r, --raw, --raw-shell 執(zhí)行一個原始的shell命令 --priv 指定一個私鑰進(jìn)行驗(yàn)證 --roster 指定哪個roster系統(tǒng)要被使用,可以是database、scanner、custom roster,默認(rèn)是平面文件roster系統(tǒng) --roster-file 指定默認(rèn)的roster本地文件位置,默認(rèn)的文件名是roster,位置在master的/etc/salt//roster --refresh, --refresh-cache q強(qiáng)制刷新master上的緩存數(shù)據(jù),這種情況一般出現(xiàn)在minion的grains已經(jīng)變化了的情況 --max-procs 同時和多少minion進(jìn)行通訊,啟動的進(jìn)程越多則通訊的速度越快,默認(rèn)是25 -i, --ignore-host-keys 忽視ssh主機(jī)keys,默認(rèn)情況下連接要征求同意 --passwd 在連接進(jìn)行認(rèn)證時設(shè)置默認(rèn)的密碼 --key-deploy Set this flag to attempt to deploy the authorized ssh key with all minions. This combined with --passwd can make initial deployment of keys very fast and easy. ???? /etc/salt/roster文件的格式如下:
web1:host: IP # The IP addr or DNS hostnameuser: test # Remote executions will be executed as user fredpasswd: xxxxx
轉(zhuǎn)載于:https://my.oschina.net/guol/blog/337200
總結(jié)
以上是生活随笔為你收集整理的saltstack实战-6的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【转】JCR期刊分区及其检索方法
- 下一篇: 【沟通的艺术】你能勾住你的听众么?