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.
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 systems
Installation
From Automation Hub
First, configure your ansible.cfg:
``ini
[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:
`bash
ansible-galaxy collection install redhat.ai
`
Using requirements.yml
`yaml
---
collections:
- name: redhat.ai
`
`bash
ansible-galaxy collection install -r requirements.yml
`
Key Modules
ilab_init — Initialize InstructLab
Create an initial InstructLab configuration:
`yaml
- 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:
`yaml
- 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 }}"
`
Complete Example Playbook
`yaml
---
- 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
1. Store credentials in Vault — Never hardcode registry credentials
2. **Use specifi