How do I get logs/details of ansible-playbook module executions?

后端 未结 6 1939
攒了一身酷
攒了一身酷 2020-12-22 18:45

Say I execute the following.

$ cat test.sh
#!/bin/bash
echo Hello World
exit 0

$ cat Hello.yml
---

- hosts: MyTestHost
  tasks:
  - name: Hello yourself
           


        
6条回答
  •  再見小時候
    2020-12-22 18:51

    Using callback plugins, you can have the stdout of your commands output in readable form with the play: gist: human_log.py

    Edit for example output:

     _____________________________________
    < TASK: common | install apt packages >
     -------------------------------------
            \   ^__^
             \  (oo)\_______
                (__)\       )\/\
                    ||----w |
                    ||     ||
    
    
    changed: [10.76.71.167] => (item=htop,vim-tiny,curl,git,unzip,update-motd,ssh-askpass,gcc,python-dev,libxml2,libxml2-dev,libxslt-dev,python-lxml,python-pip)
    
    stdout:
    Reading package lists...
    Building dependency tree...
    Reading state information...
    libxslt1-dev is already the newest version.
    0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
    
    
    stderr:
    
    start:
    2015-03-27 17:12:22.132237
    
    end:
    2015-03-27 17:12:22.136859
    

提交回复
热议问题