Knowledge base
  • Goal of knowledge base
  • Linux & core
    • Linux
      • Record SSH session for reporting
      • Compress / Decompress files
      • Colorize logs
      • Cron output & logging
      • Signal
      • Break out and escape SSH session
      • Mount volume permanently
      • Show processes most consuming CPU & MEM
      • Improve and optimize battery life on Linux
      • File ownership & groups in linux
      • Automatic security update/patch on Ubuntu
      • Clean buffers and cached on linux
      • Bash completion on Linux/Mac
    • Core services
      • Nginx reload
      • OpenVPN Split tunneling
      • Nmap commands
    • Hardware
      • CPU Architecture fundamental
  • Database
    • MySQL
      • InnoDB - innodb_file_per_table parameter
      • MySQL - enable slow query log
      • MySQL - export large tables
    • MongoDB
  • Container
    • Docker
      • ADD or COPY in Dockerfile
        • Clean data of docker completely
    • Podman
  • Automation
    • Ansible
      • Output format
  • Build & Deployment
    • Jenkins
      • Jenkins - force exit pipeline when failure
  • Language & Toolset
    • PHP
      • Composer
      • php-redis & php-igbinary
  • Mindset
    • Technical based
      • Writing well
      • Reinvent The Wheel
      • Approach a new system
      • Backup philosophy
      • Mindset for building HA and scalable system
      • GitLab database incident
    • Non-technical based
      • How to read news efficiency?
      • How long should you nap?
      • Assume good faith
  • Reference & learning source
    • Books
      • Sysadmin/SRE
      • Mindsets
      • Software fundamentals
    • English
Powered by GitBook
On this page
  • Human-readable
  • Reference
  1. Automation
  2. Ansible

Output format

Human-readable

Best way to format output for easy debugging is running with one level of verbose -v and config ANSIBLE_STDOUT_CALLBACK=debug for callback output login, also print pure stdout

Or add stdout_callback = debug to file ansible.cfg

TASK [Config backend directory] ************************************************
changed: [default] => {
    "changed": true, 
    "gid": 33, 
    "group": "www-data", 
    "mode": "0775", 
    "owner": "www-data", 
    "path": "/var/www", 
    "size": 4096, 
    "state": "directory", 
    "uid": 33
}

TASK [shell] *******************************************************************
changed: [default] => {
    "changed": true, 
    "cmd": "cp -r /home/ubuntu/* /****/", 
    "delta": "0:00:00.003310", 
    "end": "2019-02-20 04:27:35.078530", 
    "rc": 0, 
    "start": "2019-02-20 04:27:35.075220"
}

TASK [copy] ********************************************************************
changed: [default] => {
    "changed": true, 
    "checksum": "827c6dd2d1f982794c8bf413708c9b8207252c5b", 
    "dest": "/etc/supervisor/conf.d/msg-worker-supervisord.conf", 
    "gid": 0, 
    "group": "****", 
    "md5sum": "6d007a703729673056bc9b0ec4a1367b", 
    "mode": "0775", 
    "owner": "****", 
    "size": 261, 
    "src": "/****/msg-worker-supervisord.conf", 
    "state": "file", 
    "uid": 0
}

TASK [Run migration on template subdomain] *************************************
changed: [default] => {
    "changed": true, 
    "cmd": "runuser --user=www-data -- /var/www/backend-symfony/current/bin/console doctrine:migrations:migrate --instance=instance_template.ahihi.io --env=prod", 
    "delta": "0:00:00.458270", 
    "end": "2019-02-20 04:27:37.223567", 
    "rc": 0, 
    "start": "2019-02-20 04:27:36.765297"
}

STDOUT:

****@instance_template: 
                                                              
                    Application Migrations                    
                                                              

Migrating up to 20190218074800 from 20190215121527

  ++ migrating 20190218074800

     -> DELETE FROM contents_status_translations WHERE status_id IN (1, 2, 3, 4)
     -> INSERT INTO contents_status_translations (status_id, `language`, field, `value`) VALUES (1, 'de', 'name', 'Idee'), (2, 'de', 'name', 'In Produktion'), (3, 'de', 'name', 'Veröffentlicht'), (4, 'de', 'name', 'Abgelehnt')

  ++ migrated (0.06s)

  ------------------------

  ++ finished in 0.06s
  ++ 1 migrations executed
  ++ 2 sql queries

Reference

PreviousAnsibleNextJenkins

Last updated 6 years ago

Docs:

Comparison:

https://docs.ansible.com/ansible/devel/plugins/callback.html
https://rndmh3ro.github.io/