A module is an executable unit
In Ansible, a module is a unit that can be executed. Each module has a particular use, from installing packages, copying files, administering users, and so on.
Ansible has a huge number of modules while some of them are common, such as "yum", "file", "lineinfile", "fetch", "service", etc.
A module can be written in python or other languages.
A module is bound to a task
A task can have only one module. You can execute a single task once with ansible ad-hoc command. You can have many tasks inside a play.Some examples
# "raw" module can be executed without python installed on managed servers$ ansible all -m raw -a 'ls /'
# "shell" module can be executed without python installed on managed servers
$ ansible all -m shell -a 'ls /'
# "command" module is the default module, so the following two commands are same
$ ansible all -a 'uname -r'
$ ansible all -m command -a 'uname -r'
No comments:
Post a Comment