SaltStack學習記錄-02(格式化輸出)

以指定的格式輸出一條salt命令的執行結果

1、顯示一條salt命令的概要

[root@sv001 salt]# salt --summary '*' cmd.run_all 'echo 123'
sv001:
    ----------
    pid:
        8874
    retcode:
        0
    stderr:
    stdout:
        123


-------------------------------------------
Summary
-------------------------------------------
# of Minions Targeted: 1
# of Minions Returned: 1
# of Minions Did Not Return: 0
-------------------------------------------

2、以json格式輸出

[root@sv001 salt]# salt --out=json '*' cmd.run_all 'echo test cmd'
{
    "sv001": {
        "pid": 8979,
        "retcode": 0,
        "stderr": "",
        "stdout": "test cmd"
    }
}

3、以YAML的格式輸出

[root@sv001 salt]# salt --out=yaml '*' cmd.run_all 'echo this is a test cmd'
sv001:
  pid: 9018
  retcode: 0
  stderr: ''
  stdout: this is a test cmd

4、其他格式
salt命令的–out選項還可以選擇 raw、nested、quiet等格式。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章