You are on page 1of 2

Ansible Modules

1. file
The File module allows you to control the state of files and directories setting permissions,
ownership, and SELinux labels.
For instance, use the file module to create a directory /app owned by the user ricardo, with
read, write, and execute permissions for the owner and the group users:
name: Ensure directory /app exists
file:
path: /app
state: directory
owner: Sidhu
group: users
mode: 0770

2. command

The command module is a flexible one that allows you to execute arbitrary commands on the target system.
Using this module, you can do almost anything on the target system as long as there's a command for it.

name: Run the app installer

command: "/app/install.sh"

3. service

Use the service module to manage the target system services using the required in it system; for example,
systemd.

name:Ensure SSHD is statrted


service:
name: sshd
state: started

4. package

he package module allows you to install, update, or remove software packages from your target system
using the operating system standard package manager.

name: Ensure Apache package is installed


package:
name: httpd
state: present

5. Debug
The debug module prints statements during execution and can be useful for debugging variables or expressions
without having to halt the playbook.

You might also like