Ansible Core Modules and Aliases
Ansible's core modules are the built-in modules that come with Ansible, providing essential functionality for configuration management, deployment, and orchestration tasks. These modules cover a wide range of tasks, such as managing files, packages, services, and users, as well as handling system configuration and network settings.
Core Modules
Here are some commonly used core modules in Ansible:
File and Directory Management
ansible.builtin.copy: Copies files to remote locations.ansible.builtin.file: Manages files and directory properties.ansible.builtin.fetch: Fetches files from remote nodes.ansible.builtin.template: Processes and deploys Jinja2 templates.
Package Management
ansible.builtin.package: Generic package manager (handlesapt,yum,dnf, etc.).ansible.builtin.apt: Manages packages with theaptpackage manager.ansible.builtin.yum: Manages packages with theyumpackage manager.ansible.builtin.dnf: Manages packages with thednfpackage manager.
Service Management
ansible.builtin.service: Manages services (start, stop, restart, enable, disable).ansible.builtin.systemd: Manages systemd services.
User and Group Management
ansible.builtin.user: Manages user accounts.ansible.builtin.group: Manages groups.
System and Network Configuration
ansible.builtin.command: Executes commands on remote nodes.ansible.builtin.shell: Executes shell commands on remote nodes.ansible.builtin.sysctl: Manages sysctl parameters.
File System and Storage
ansible.builtin.mount: Manages file system mount points.ansible.builtin.parted: Manages disk partitions.
Aliases
In Ansible, an alias is a way to reference a module by a different name. The ansible.builtin namespace is the standard namespace for built-in modules in Ansible. This makes it clear that the module is a built-in, core module rather than one from a collection or third-party source.
Examples of Core Modules and Their Aliases
packageandansible.builtin.package- Both refer to the same generic package management module.
- name: Install a package
package:
name: httpd
state: present
- name: Install a package
ansible.builtin.package:
name: httpd
state: present
- name: Copy a file
copy:
src: /path/to/local/file
dest: /path/to/remote/file
- name: Copy a file
ansible.builtin.copy:
src: /path/to/local/file
dest: /path/to/remote/file- Both refer to the same generic package management module.
Comments
Post a Comment