# ansible-cli-js

> A node.js wrapper for the ansible command

Latest version **2.0.5** (published 2019-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install ansible-cli-js
pnpm add ansible-cli-js
yarn add ansible-cli-js
bun add ansible-cli-js
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2019-07-31 |
| First published | 2015-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Matthias Ludwig |
| Maintainers | mattqs |
| Keywords | ansible |

## Links

- npm: https://www.npmjs.com/package/ansible-cli-js
- Repository: https://github.com/Quobject/ansible-cli-js
- Issues: https://github.com/Quobject/ansible-cli-js/issues
- npm.io page: https://npm.io/package/ansible-cli-js

## Dependencies (2)

- [core-js](https://npm.io/package/core-js.md) ^3.1.4
- [nodeify-ts](https://npm.io/package/nodeify-ts.md) ^1.0.6

## Recent versions

- 2.0.5 (latest) — 2019-07-31
- 2.0.4 — 2016-06-04
- 2.0.3 — 2016-05-26
- 2.0.2 — 2016-05-24
- 2.0.1 — 2016-05-24
- 2.0.0 — 2016-05-24
- 0.0.2 — 2015-10-05
- 0.0.1 — 2015-10-05

## README

# ansible-cli-js
A node.js wrapper for the [ansible](http://linux.die.net/man/1/ansible) command

[![NPM](https://nodei.co/npm/ansible-cli-js.png?downloads=true&downloadRank=true)](https://nodei.co/npm/ansible-cli-js/)
[![NPM](https://nodei.co/npm-dl/ansible-cli-js.png?months=6&height=3)](https://nodei.co/npm/ansible-cli-js/)

[![NPM version][npm-image]][npm-url]
[![NPM downloads][downloads-image]][downloads-url]

## Installation

### Step 1: Prerequisites

[Ansible](http://www.ansible.com/) must be installed and accessible in the path

### Step 2: Installation
    
    npm install ansible-cli-js
    
Then:

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

```

## Usage

With promise:

```js
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:

```js

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

```


Typescript:

```js
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

[npm-image]: https://img.shields.io/npm/v/ansible-cli-js.svg?style=flat
[npm-url]: https://npmjs.org/package/ansible-cli-js
[downloads-image]: https://img.shields.io/npm/dm/ansible-cli-js.svg?style=flat
[downloads-url]: https://npmjs.org/package/ansible-cli-js

---
_Source: https://npm.io/package/ansible-cli-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
