Getting Started with the redhat.ai Ansible Collection for AI Model Management
By Luca Berton · Published 2024-01-01 · Category: installation
How to install and use the redhat.ai Ansible Collection to manage Red Hat AI environments, deploy AI models, and automate MLOps workflows on RHEL AI.

Introduction
The redhat.ai Ansible Collection provides automation tools for managing Red Hat AI environments, streamlining MLOps workflows, and deploying AI models efficiently on Red Hat Enterprise Linux AI (RHEL AI). This article covers installation, configuration, and practical usage.
See also: Getting Started with Ansible Lightspeed Intelligent Assistant in AAP 2.6
What is the redhat.ai Collection?
The redhat.ai collection is a Red Hat Certified Collection available through Automation Hub. It includes:
• 4 Modules for AI model management
• 1 Role for environment setup
• 2 Plugins for integration
Key capabilities: • Initialize InstructLab configurations • Download AI models from registries • Manage model serving and inference • Automate RHEL AI deployments
Requirements
• Ansible 2.16.0 or newer • Python 3.10 or newer • Access to Red Hat Automation Hub (for certified content) • Red Hat Enterprise Linux AI (RHEL AI) target systemsSee also: Deploying RHEL AI Infrastructure with the infra.ai Ansible Collection
Installation
From Automation Hub
First, configure your ansible.cfg:
[galaxy]
server_list = automation_hub
[galaxy_server.automation_hub]
url=https://cloud.redhat.com/api/automation-hub/
auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token
token=<your-automation-hub-token>
Then install:
ansible-galaxy collection install redhat.ai
Using requirements.yml
---
collections:
- name: redhat.ai
ansible-galaxy collection install -r requirements.yml
Key Modules
ilab_init — Initialize InstructLab
Create an initial InstructLab configuration:
- name: Create initial ilab config
redhat.ai.ilab_init:
register: init_result
- name: Display init result
ansible.builtin.debug:
var: init_result
ilab_model_download — Download AI Models
Download models from Red Hat's container registry:
- name: Download Granite model
redhat.ai.ilab_model_download:
name: granite-8b-starter-v1
release: latest
registry_url: docker://registry.redhat.io
registry_namespace: rhelai1
registry_username: "{{ registry_user }}"
registry_password: "{{ registry_pass }}"
See also: New Collections and Integrations in Ansible Automation Platform 2.6
Complete Example Playbook
---
- name: Deploy AI Model on RHEL AI
hosts: ai_servers
become: true
tasks:
- name: Initialize InstructLab
redhat.ai.ilab_init:
register: init_result
- name: Download the Granite model
redhat.ai.ilab_model_download:
name: granite-8b-starter-v1
release: latest
registry_url: docker://registry.redhat.io
registry_namespace: rhelai1
registry_username: "{{ vault_registry_user }}"
registry_password: "{{ vault_registry_pass }}"
- name: Verify model is available
ansible.builtin.command:
cmd: ilab model list
register: model_list
- name: Display available models
ansible.builtin.debug:
var: model_list.stdout_lines
Best Practices
Store credentials in Vault — Never hardcode registry credentials Use specific model versions — Pin model releases for reproducibility Test in development — Validate model deployments before production Monitor resources — AI model serving requires significant compute resourcesConclusion
The redhat.ai collection brings the power of Ansible automation to AI/ML workflows. By automating model deployment and management, teams can accelerate their AI initiatives while maintaining consistency and governance.
For more Ansible tutorials and guides, explore the complete article collection on Ansible Pilot.
Related Articles
• Ansible Galaxy authentication • managing Docker with Ansible • Ansible privilege escalation patterns • Ansible Vault guideCategory: installation