Last Updated: February 25, 2016
· lorin
Me pixel

Unbuffered output with ansible in jenkins

When I run an Ansible playbook inside a Jenkins task, I like to turn off stdout buffering so that I can see the next output line immediately in the Jenkins console view.

This is particularly helpful when ansible blocks on a task, since buffering can suppress the output.

Since ansible-playbook is a Python script, the simplest way to disable buffering is to set the PYTHONUNBUFFERED environment variable in your Jenkins script before running your playbook:

ansible-playbook myplaybook.yaml
Say Thanks

1 Response
Add your response


This is also useful if you want to run ansible in the background using nohup &

over 1 year ago ·
Filed Under