🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ansible-playbook-cli-js

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansible-playbook-cli-js

A node.js wrapper for the ansible-playbook command

1.0.3
Source
npm
Version published
Maintainers
1
Created
Source

ansible-playbook-cli-js

A node.js wrapper for the ansible-playbook command

NPM NPM

Installation

Step 1: Prerequisites

Ansible must be installed and accessible in the path

Step 2: Installation

npm install ansible-playbook-cli-js

Then:

var AnsiblePlaybookCli = require('ansible-playbook-cli-js');

Usage

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 }
//}

Keywords

ansible-playbook

FAQs

Package last updated on 03 Nov 2015

Did you know?

Socket

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.

Install

Related posts