About
Module are the component that are called via a task
Articles Related
Management
List
Run
- With ansible, example running a module
ansible all -i sub.example.net, -m moduleToRun
where:
- all is the host group(s) to which the command should apply (in this case, all)
- the inventory (-i, the device or devices to target - without the trailing comma -i points to an inventory file)
- the module (-m, the ansible module to run)
Types
Name | New / Old Style Module | Note |
---|---|---|
Action plugins | Take actions before executing a module | |
Python | New-style | |
Powershell | New-style | Written with the powershell module framework |
Binary modules | ||
Want JSON modules | Get a JSON file with the module parameters (Non-native module) | |
JSONARGS | Replace a placeholder in the script with the parameters of the module | |
Old-style modules | similar to want JSON modules, except that the file that they take contains key=value pairs for their parameters instead of JSON. Ansible decides that a module is old-style when it doesn’t have any of the markers that would show that it is one of the other types. |
All official modules (shipped with Ansible) use either Ansiballz framework or the powershell module framework.
New-style modules - All of the modules that ship with Ansible fall into this category. - New-style modules have the arguments to the module embedded inside of them in some manner whereas Non-new-style modules must copy a separate file over to the managed node, which is less efficient as it requires two over-the-wire connections instead of only one.
Devel
https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html
Example: https://github.com/mapr-emea/mapr-ansible/tree/master/library