2017-05-25 95 views

回答

2

的情況你可以做到這樣的,在這裏,你應該改變從debug行動到你想要的東西。

在這裏,我們是在該目錄(no which you want to perform action

收集文件的列表,並使用debug我們打印了特定命令的輸出。

注:你應該改變我的debug例如你想要你的行動。

--- 
- hosts: "localhost" 
    gather_facts: no 
    tasks: 
    - name: "Looking for files" 
    command: ls /path/to/directory 
    register: command_output 
    - name: "Looking for output" 
    debug: 
    msg: "{{command_output}}" 
    when: command_output.stdout != "" 
相關問題