Ansible - Module

Card Puncher Data Processing

About

Module are the component that are called via a task

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

Documentation / Reference





Discover More
Card Puncher Data Processing
Ansible - (Windows|Powershell) Module

Windows module are written in Powershell These modules get a library of powershell code embedded in them before being sent to the managed node. They are written with the ...
Card Puncher Data Processing
Ansible - Action Plugin Module Type

An Action Plugin is a type of module that: set up some values on the controller, (ie create a start state) then invoke an other module on the managed node that does something with these values.
Card Puncher Data Processing
Ansible - Ansible command line

Ansible define and run a single playbook task against a set of hosts. Ansible “raw” module is a command line for executing commands in a quick and dirty way. The script module don’t even need...
Card Puncher Data Processing
Ansible - Binary Module Type

Binary is a type of modules that take its arguments and will return data to Ansible in the same way as want JSON modules. In Go: ansible/ansible/blob/devel/test/integration/targets/binary_modules/library/helloworld.goHelloWorld...
Card Puncher Data Processing
Ansible - Copy Module (Remote File System operation)

The copy module operates on the remote system to move the file into its final location, sets file permissions, and so on. See ...
Card Puncher Data Processing
Ansible - Debug module

debug module diagnostic page With the ansible command line Example to get the ansible_host value where: ansible command line inventory is an inventory file -m set the module to debug -a...
Card Puncher Data Processing
Ansible - JsonArgs Module Type

JsonArgs is a module type. It's a script that contains the following placeholder <> placeholder. During execution, Ansible will replace it with the module parameters....
Card Puncher Data Processing
Ansible - Playbook

Playbook is the language of Ansible. Ansible modules are the function Playbooks are declarative instruction written in Yaml that run module functions A playbook is a list of play. Playbooks are:...
Card Puncher Data Processing
Ansible - Template module

The template module is an Action Plugin module. It constructs a file in a temporary location on the controller using variables from the playbook environment or from the user transfers the temporary...
Card Puncher Data Processing
Ansible - Want Json Module Type

Json (or Want Json) is a Module type. A non-native module accepts a filename as its only command line parameter. Ansible creates this file with the module parameters and pass it to the module. The...



Share this page:
Follow us:
Task Runner