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

ansible-js-bindings

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansible-js-bindings

This library is a js bindings of ansible-playbook.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ansible-js-bindings

This library is a js bindings of ansible-playbook.

It provided two drop-in API of exec and execFile which are similiar to child_process.exec/child_process.execFile but will execute on remote nodes.

Prepare

git clone http://github.xsky.com/testing/ansible-js-bindings.git && cd ansible-js-bindings

Setup inventory

add nodes in inventory file

Run

Execute command

const path = require('path');
const Ansible = require('../src');

const ansible = new Ansible({
  inventoryPath: path.resolve(__dirname, 'assets/inventory'),
});

(async function() {
  try {
    let res;
    console.log('execute shell command');
    res = await ansible.exec(
      'echo "test ansible js bindings with execute inline shell"'
    );
    console.log('shell result:', res);
  } catch (error) {
    console.error(error);
  }
})();

Execute file

const path = require('path');
const Ansible = require('../src');

const ansible = new Ansible({
  inventoryPath: path.resolve(__dirname, 'assets/inventory'),
});

(async function() {
  try {
    let res;
    console.log('execute shell script');
    res = await ansible.execFile(path.resolve(__dirname, 'assets/example.sh'));
    console.log('shell result:', res);
    console.log('execute python script');
    res = await ansible.execFile(path.resolve(__dirname, 'assets/example.py'));
    console.log('python result:', res);
  } catch (error) {
    console.error(error);
  }
})();

FAQs

Package last updated on 21 Apr 2018

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