
Product
Introducing Socket Fix for Safe, Automated Dependency Upgrades
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
ansible-playbook-cli-js
Advanced tools
A node.js wrapper for the ansible-playbook command
Ansible must be installed and accessible in the path
npm install ansible-playbook-cli-js
Then:
var AnsiblePlaybookCli = require('ansible-playbook-cli-js');
With promise
var ansiblePlaybookCli = new AnsiblePlaybookCli({
cwd: 'test1'
});
ansiblePlaybookCli.command('playbook.yml -i hosts').then(function (data) {
console.log('data = ', data);
});
//data = {
// command: 'ansible-playbook playbook.yml -i hosts ',
// raw: '["\\nPLAY [create test dir] ******************************************************** \\n\\nGATHERING FACTS *************************************************************** \\nok: [127.0.0.1]\\n\\nTASK: [create tmp2 dir] ******************************************************* \\nok: [127.0.0.1]\\n\\nPLAY RECAP ******************************************************************** \\n127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 \\n\\n",""]',
// lines:
// ['',
// 'PLAY [create test dir] ******************************************************** ',
// '',
// 'GATHERING FACTS *************************************************************** ',
// 'ok: [127.0.0.1]',
// '',
// 'TASK: [create tmp2 dir] ******************************************************* ',
// 'ok: [127.0.0.1]',
// '',
// 'PLAY RECAP ******************************************************************** ',
// '127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 ',
// '',
// ''],
// object: { host: '127.0.0.1', ok: 2, changed: 0, unreachable: 0, failed: 0 }
//}
With callback:
ansiblePlaybookCli.command('playbook.yml --inventory-file hosts', function (err, data) {
console.log('data = ', data);
});
//data = {
// command: 'ansible-playbook playbook.yml --inventory-file hosts ',
// raw: '["\\nPLAY [create test dir] ******************************************************** \\n\\nGATHERING FACTS *************************************************************** \\nok: [127.0.0.1]\\n\\nTASK: [create tmp2 dir] ******************************************************* \\nok: [127.0.0.1]\\n\\nPLAY RECAP ******************************************************************** \\n127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 \\n\\n",""]',
// lines:
// ['',
// 'PLAY [create test dir] ******************************************************** ',
// '',
// 'GATHERING FACTS *************************************************************** ',
// 'ok: [127.0.0.1]',
// '',
// 'TASK: [create tmp2 dir] ******************************************************* ',
// 'ok: [127.0.0.1]',
// '',
// 'PLAY RECAP ******************************************************************** ',
// '127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 ',
// '',
// ''],
// object: { host: '127.0.0.1', ok: 2, changed: 0, unreachable: 0, failed: 0 }
//}
With options
ansiblePlaybookCli.command('playbook.yml', { 'inventory-file': 'hosts' }).then(function (data) {
console.log('data = ', data);
});
//data = {
// command: 'ansible-playbook playbook.yml --inventory-file hosts ',
// raw: '["\\nPLAY [create test dir] ******************************************************** \\n\\nGATHERING FACTS *************************************************************** \\nok: [127.0.0.1]\\n\\nTASK: [create tmp2 dir] ******************************************************* \\nok: [127.0.0.1]\\n\\nPLAY RECAP ******************************************************************** \\n127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 \\n\\n",""]',
// lines:
// ['',
// 'PLAY [create test dir] ******************************************************** ',
// '',
// 'GATHERING FACTS *************************************************************** ',
// 'ok: [127.0.0.1]',
// '',
// 'TASK: [create tmp2 dir] ******************************************************* ',
// 'ok: [127.0.0.1]',
// '',
// 'PLAY RECAP ******************************************************************** ',
// '127.0.0.1 : ok=2 changed=0 unreachable=0 failed=0 ',
// '',
// ''],
// object: { host: '127.0.0.1', ok: 2, changed: 0, unreachable: 0, failed: 0 }
//}
FAQs
A node.js wrapper for the ansible-playbook command
The npm package ansible-playbook-cli-js receives a total of 136 weekly downloads. As such, ansible-playbook-cli-js popularity was classified as not popular.
We found that ansible-playbook-cli-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Automatically fix and test dependency updates with socket fix—a new CLI tool that turns CVE alerts into safe, automated upgrades.
Security News
CISA denies CVE funding issues amid backlash over a new CVE foundation formed by board members, raising concerns about transparency and program governance.
Product
We’re excited to announce a powerful new capability in Socket: historical data and enhanced analytics.