Ansible-Doc Cheat Sheet

Essential reference for RHCE Exam (EX294)

Exam Tip: The RHCE exam is closed-book, but you can use ansible-doc during the test. Practice these commands before your exam!

Basic Commands

List All Modules
ansible-doc -l

Lists all available Ansible modules.

View Module Documentation
ansible-doc <module_name>

Show full documentation for a module.

# Example:
ansible-doc yum
Short Syntax Help
ansible-doc -s <module_name>

Show brief syntax and parameters.

# Example:
ansible-doc -s service

Essential Modules for RHCE

Module Purpose Common Parameters
yum/dnf Package management name, state (present/absent/latest)
service Manage services name, state (started/stopped), enabled
copy Copy files src, dest, owner, mode
template Jinja2 templating src, dest
file Manage files/dirs path, state (file/directory/link)
firewalld Firewall configuration service, port, permanent

Common Module Examples

Package Management
- name: Install Apache
  ansible.builtin.yum:
    name: httpd
    state: latest
Service Management
- name: Start and enable httpd
  ansible.builtin.service:
    name: httpd
    state: started
    enabled: yes
File Management
- name: Ensure directory exists
  ansible.builtin.file:
    path: /etc/myapp
    state: directory
    mode: '0755'
Remember: During the RHCE exam, you can use ansible-doc to check module syntax, but you won't have internet access. Practice these commands thoroughly before your exam.