Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[proposal] Ansible Plugin Builder #1

Closed
NilashishC opened this issue Oct 8, 2021 · 0 comments
Closed

[proposal] Ansible Plugin Builder #1

NilashishC opened this issue Oct 8, 2021 · 0 comments

Comments

@NilashishC
Copy link
Collaborator

Summary

The proposal is to add an Ansible collection that scaffolds a variety of plugin types based on user provided criteria.

This has already been committed to and initial work has been added to this repository. Please have a look at https://github.com/ansible-collections/ansible.plugin_builder/README.md for more details.

What's the opportunity?

Provide tooling to scaffold out the basic python structure for all plugin types including:

  • cache
  • callback
  • test
  • filter
  • inventory
  • lookup
  • connection
  • action
  • module (including but not restricted to generic module, generic resource module, network resource module, security resource module)
  • vars

This would include the main plugin file for the specific plugin, as well as examples files in the respective utils directory

What's the approach?

The user would populate a manifest file that would include things such as plugin name, plugin type, collection specifics, doc string, examples. The playbook and corresponding collection would scaffold the python source files, with placeholders and/or examples code that the user would need to modify.

In the case of an action/module, additional information may be required such as: Can the plugin run on the control node? Will the plugin hit a REST API, Will the plugin use a 3rd party python package for logic and connection.

The additional information can be used to steer the user toward the appropriate plugin type (action/module)
The intent is that ansible.plugin_builder be a living tools that improves over time based on a community and user feedback loop. Additionally, less well known approaches can be incorporated such as the use of the persistent connection framework, deriving the argspec from the doc string at runtime, common code bases for filter and lookup, doc string for all plugin types, return value validation outbound, etc.

This should avoid the photocopy issue of plugins being built from other plugins, instead provide a starting point that incorporates good practices and techniques.

The work will start small, as a POC, and be iterated on over time.

Reference: Although this is very specific to network resource modules, the workflow and product may serve as a good example https://github.com/ansible-network/cli_rm_builder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant