Hello,
I've possibly found a bug, but I would like to confirm before creating a
ticket.
I'm trying to capture output of a remote script executed using the
'script' module. If sudo is not enabled, everything works just fine and
I can use result.stdout. However, if sudo is enabled, sudo "success_key"
is embedded into result.stdout if I'm using the script module. The same
problem do not affect 'command' module.
This was tested with ansible 1.4.3 (pip), as well as the development
version from git. It used to work just fine with ansible 1.3.4.
The following playbook demonstrates the issue:
---
#
- name: "Test with sudo and register"
hosts: www-php5-4
tasks:
- command: /bin/ls /
register: result
- debug: "var=result.stdout"
- script: files/scripts/list_dir "/"
register: result
- debug: "var=result.stdout"
Where list_dir could be any script.
Here is the verbose output:
TASK: [command /bin/ls /]
*****************************************************
changed: [www-php5-4] => {"changed": true, "cmd": ["/bin/ls", "/"],
"delta": "0:00:00.009592", "end": "2014-01-07 13:58:27.294366", "rc": 0,
"start": "2014-01-07 13:58:27.284774", "stderr": "", "stdout":
"bin\nboot\ndev\netc\nhome\nhome-sys\ninitrd.img\nlib\nlib64\nlost+found\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nselinux\nsrv\nsys\ntmp\nusr\nvar\nvmlinuz"}
TASK: [debug var=result.stdout]
***********************************************
ok: [www-php5-4] => {
"result.stdout":
"bin\nboot\ndev\netc\nhome\nhome-sys\ninitrd.img\nlib\nlib64\nlost+found\nmedia\nmnt\nopt\nproc\nroot\nrun\nsbin\nselinux\nsrv\nsys\ntmp\nusr\nvar\nvmlinuz"
}
TASK: [script files/scripts/list_dir "/"]
*************************************
changed: [www-php5-4] => {"changed": true, "rc": 0, "stderr": "",
"stdout": "\r\nSUDO-SUCCESS-wbzcrtmosfpuylypyhbeoaxovzwkmgjw\r\nbin
etc\tinitrd.img lost+found\topt run srv usr\r\nboot
home\tlib\t media\tproc sbin sys var\r\ndev home-sys\tlib64\t
mnt\t\troot selinux tmp vmlinuz\r\n"}
TASK: [debug var=result.stdout]
***********************************************
ok: [www-php5-4] => {
"result.stdout":
"\r\nSUDO-SUCCESS-wbzcrtmosfpuylypyhbeoaxovzwkmgjw\r\nbin
etc\tinitrd.img lost+found\topt run srv usr\r\nboot
home\tlib\t media\tproc sbin sys var\r\ndev home-sys\tlib64\t
mnt\t\troot selinux tmp vmlinuz\r\n"
}
I think "SUDO-SUCCESS-wbzcrtmosfpuylypyhbeoaxovzwkmgjw" do not belong
there. Would you confirm this is a bug?
If you have some hint on where possibly is the problem, I would not mind
to dig a bit further and submit a patch.
Best regards,
Luciano
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.