Hi,
Forgive me for my bad english. I'm trying to run my playbook from nodejs. My playbook is running well, but I can't get the result code of execution with promise:
` var Ansible = require('node-ansible');
var command = new Ansible.Playbook().playbook('main');
command.inventory(ip+","); //the ip adress is dynamic so I can't use an inventory
if (image_type === "Linux") {
command.variables({
myvar1: "test variable from node js",
myvar2: "another test"
});
command.verbose('v');
}
/*command.on('stdout', function(data) {
logger.info(data.toString());
});
command.on('stderr', function(data) {
logger.error(data.toString());
});*/
var promise = command.exec({cwd:"../ansible",buffered:true});
promise.then(function(result) {
// nothing is logged on console
console.log(result.output);
console.log("===========>"+result.code);
});
/*var promise = command.exec({cwd: "../ansible", buffered: true});
promise.then(function(data){
console.log("===========> unbuf: "+data.output);
console.log("===========> unbuf: "+data.code);
});*/
`
Any idea ?
Hi,
Forgive me for my bad english. I'm trying to run my playbook from nodejs. My playbook is running well, but I can't get the result code of execution with promise:
` var Ansible = require('node-ansible');
`
Any idea ?