TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

NPM Package: Ansibler

Performs various tasks required for generating sleek documentation for Ansible playbooks and roles


➤ Table of Contents


➤ Requirements


➤ Overview

Ansibler is a set of tools used to manage Ansible playbooks and roles. It provides the following functionality:


➤ Getting Started

You can run ansibler by installing it globally (i.e. npm install -g @megabytelabs/ansibler) or running it with npx. You can then run ansibler --help to see the available parameters. You should see output that looks something like this:

❯ ansibler --help
Usage: ansibler [options]

-h, --help Displays help
-d, --data String Relative path to the data file.
-o, --output String Relative path to the output file - default: ./ansible-molecule.json
-c, --command String Additional commands to run before analyzing
-i, --inject String Inject output to a JSON file


➤ Example Usage

Ansibler has several different features that can be individually run or run all at the same time.

Populating the Role Dependency Chart for the Main Playbook

To generate the role dependency chart (that you can see in the README of our Playr repository), you should:

  1. Make sure all the roles are located in the roles/ folder of your project and that each role has a valid description.
  2. Run ansibler --roles "./roles" --output "./role-chart.json" --populate-descriptions

The command above will scan through the roles/ folder and extract all of the descriptions into a JSON file. It might be important to know that a special format is used that is meant to be compatible with @appnest/readme which is the documentation generator we use.

Example Output

After running the above command (in step 2 above), you will be left with a file titled role-chart.json in the current working directory that might look something like this:

  "role_dependencies": [
    ["Role Dependency", "Description", "Supported OSes"],
      "<a href=''>professormanhattan.androidstudio</a>",
      "Installs Android Studio on nearly any OS",
      "Supported OS feature not part of this task"
      "<a href=''>professormanhattan.appium</a>",
      "Installs Appium on almost any platform",
      "Supported OS feature not part of this task"
      "<a href=''>professormanhattan.autokey</a>",
      "Installs AutoKey on Linux or AutoHotkey on Windows",
      "Supported OS feature not part of this task"

Populating the Role Dependency Chart for Individual Roles

You can also generate a role dependency chart for individual roles. Instead of scanning the roles/ folder to find roles, it looks at the requirements.yml. For each role in the requirements.yml file, it will include a line in the dependency chart. The chart includes all of the same details as the main playbook dependency chart.

Automatically Updating platforms: in galaxy_info:

Every role that is published to Ansible Galaxy needs to include a file in meta/main.yml that Ansible Galaxy can use to display your role to the right users. One way the Ansible Galaxy meta/main.yml file does this is by providing a section in the file called platforms: where information can be populated to tell Ansible Galaxy which operating systems your role will work on. For hundreds of roles, this can be a tedious process.

Many of the roles available on Ansible Galaxy haphazardly list a long list of platforms which the role obviously was not tested on. That does not cut it for us. To address this issue, we developed an automated system for properly generating the platforms: compatibility chart in meta/main.yml. You can get your platforms: variable automatically populated the right way by using our two-step system:

  1. First, follow the instructions provided by our Ansible Molecule JSON project to set your role(s) up with automated testing
  2. With the JSON data that Ansible Molecule JSON generates, you can automatically populate the meta/main.yml platforms: section by running ansibler TODO

Example Output

After running the command (in step 2 above), you should be able to see a proper platforms: section in any of the roles you generated the compatibility data for. The platforms: section of the meta/main.yml file in each role should look something like this:

The Ansible community is really in need of something like this. The platforms: section should provide useful data instead of just saying that the role supports all versions of every operating system which is the case way too often.


➤ Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.


I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.


Brian Zalewski


➤ License

Copyright © 2021 Megabyte LLC. This project is MIT licensed.

Package Sidebar


npm i ansibler

Weekly Downloads






Unpacked Size

192 kB

Total Files


Last publish


  • professormanhattan