我想查看实时shell
标准输出,而不是register
在变量中输入,然后在完成后显示。
示例剧本 - test.yml
- name: Testing RUN Shell Command
hosts: localhost
connection: local
tasks:
- name: Runnig Update
shell: apt update
Run Code Online (Sandbox Code Playgroud)
默认输出
$ ansible-playbook test.yml
PLAY [Testing RUN Shell Command] ******************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************
ok: [localhost]
TASK [Runnig Update] ******************************************************************************************************************
changed: [localhost]
PLAY RECAP ****************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
Run Code Online (Sandbox Code Playgroud)
但是我想看看当我们运行apt update
终端时它在做什么
$ sudo apt update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:3 http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu bionic InRelease
Get:4 http://security.ubuntu.com/ubuntu bionic-security …
Run Code Online (Sandbox Code Playgroud)