ahelal / kitchen-ansiblepush

test-kitchen plugin to use ansible in push mode
41 stars 22 forks source link

Ansible command output is not logged #68

Open gkranis opened 1 year ago

gkranis commented 1 year ago

When running kitchen the output of the ansible command is displayed on stdout. However its missing from the kitchen logs.

So in our case .kitchen/logs/jenkins-ubuntu-1804.log contains

, [2023-02-23T17:31:12.888231 #430]  INFO -- jenkins-ubuntu-1804: *************** AnsiblePush run ***************
D, [2023-02-23T17:31:12.888364 #430] DEBUG -- jenkins-ubuntu-1804: env= <snipped blablabla> d --inventory-file=`which kitchen-ansible-inventory` --limit=kitchen test/integration/jenkins/ansible/default.yml
D, [2023-02-23T17:32:28.375982 #430] DEBUG -- jenkins-ubuntu-1804: ansible-playbook exit code = 0
I, [2023-02-23T17:32:28.376133 #430]  INFO -- jenkins-ubuntu-1804: *************** AnsiblePush end run *******************

This makes the plugin not an option for us as we rely on the logs (the standard output is unusable with --parallel)

From a quick look the output of the system call needs to be passed to a logging function. So hopefully an easy fix

gkranis commented 1 year ago

can be worked around by logging at the ansible level

environment_vars:
         ANSIBLE_LOG_PATH: "{{CWD}}/.kitchen/logs/ansible-BLABLA.log"