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

ansible-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansible-wrapper

A wrapper for the ansible cli.

0.7.0
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ansible-wrapper

Wraps the ansible CLI in a convenient NodeJS wrapper.

Installation

You will need to have ansible installed on the same machine where your nodejs application will be running.

npm install ansible-wrapper

Examples

Basic usage

const Ansible = require('ansible-wrapper');
const cmd = new Ansible.Adhoc({
  hostPattern: 'localhost',
  module: 'command',
  freeForm: 'echo "hello world"'
});

const result = await cmd.execPromise();
console.log(result);

Daisy chain

Or daisy chain the applicable functions to set the options. This results in the same as previous example.

const Ansible = require('ansible-wrapper');
const cmd = new Ansible.Adhoc();
cmd.setHostPattern('localhost')
  .setModule('command')
  .setFreeForm('echo "hello world"');

const result = await cmd.execPromise();
console.log(result);

Custom arguments

Arguments which are not supported by this library, can be set by using the addArgument() method which Ansible.Adhoc inherits from Ansible.Cli.

const Ansible = require('ansible-wrapper');
const cmd = new Ansible.Adhoc({
  hostPattern: 'localhost',
  module: 'command',
  freeForm: 'echo "hello world"'
});

// add the arguments
cmd.addArgument('-C');
cmd.addArgument('-B', 8);
cmd.addArgument('--verbose');

Documentation

The code has extensive JsDoc available. This is not yet exposed on a dedicated site.

Keywords

ansible

FAQs

Package last updated on 24 Apr 2021

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