carlessanagustin
11/28/2017 - 2:20 PM

Ansible debug module output for Docker Container status

Ansible register > debug module output

{
    "output": {
        "changed": true, 
        "cmd": "echo 'Hello World'", 
        "delta": "0:00:00.004600", 
        "end": "2018-10-02 13:17:41.073028", 
        "failed": false, 
        "rc": 0, 
        "start": "2018-10-02 13:17:41.068428", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "Hello World", 
        "stdout_lines": [
            "Hello World"
        ]
    }
}
- hosts: all
  tasks:
    - name: register variable
      shell: "echo 'Hello World'"
      register: output

    - name: display output
      debug:
        var: output