Modules: Ansible tasks contain a name, a module and parameters for the module. In the following example, the "ansible.builtin.debug" module is used and this is documented here. In the background, Ansible executes Python code to execute the defined task.
- name: Display message # Name
ansible.builtin.debug: # Module
msg: "This is a test message." # Parameter
Roles: Useful to bundle Ansible tasks and with many functions like handlers (special form of ansible tasks that are executed towards the end of a role in certain conditions) to structure tasks.
Playbook: Top-level structure which is executed by Ansible and executes roles on defined hosts.
------------------------------
Niklas
System Engineer UNIX and Linux on Power
------------------------------
Original Message:
Sent: Tue January 30, 2024 10:28 AM
From: Linda Alkire
Subject: What's the difference between modules and roles?
Could someone help me understand the difference between a module and a role in the context of Ansible Automation Platform?
#ansible-on-power
------------------------------
Linda Alkire
IBM
Minneapolis MN
------------------------------