Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansible-cli-js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansible-cli-js

A node.js wrapper for the ansible command

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
Maintainers
1
Weekly downloads
 
Created
Source

ansible-cli-js

A node.js wrapper for the ansible command

NPM NPM

NPM version NPM downloads

Installation

Step 1: Prerequisites

Ansible must be installed and accessible in the path

Step 2: Installation

npm install ansible-cli-js

Then:

var ansibleCli = require('ansible-cli-js');

Usage

With promise:

var Options = ansibleCli.Options;
var Ansible = ansibleCli.Ansible;

var options = new Options(
    /* currentWorkingDirectory */ 'ping'
);

var ansible = new Ansible(options);

ansible.command('all -m ping  --inventory-file=./inventory --connection=local').then(function (data) {
  console.log('data = ', data); 
});

//data = {
//  command: 'ansible all -m ping --inventory-file=./inventory --connection=local ',
//  raw: '["localhost | success >> {\\n    \\"changed\\": false, \\n    \\"ping\\": \\"pong\\"\\n}\\n\\n",""]'
//}

With callback:


ansible.command('ansible all -m ping --inventory-file=./inventory --connection=local', function (err, data) {
  console.log('data = ', data);
});

Typescript:

import { Ansible, Options } from 'ansible-cli-js';

const options = new Options(
  /* currentWorkingDirectory */ 'ping'
);

const ansible = new Ansible(options);

ansible.command('all -m ping --inventory-file ./inventory --connection local').then(function (data) {
  console.log('data = ', util.inspect(data, { depth: 10 }));
});

License

MIT

Keywords

FAQs

Package last updated on 31 Jul 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc