Skip to content

Commit b59d786

Browse files
committed
playbooks: Added Initial Ansible framework to deploy Intel features
Signed-off-by: Chaitanya Kulkarni <[email protected]>
1 parent 8cd73e2 commit b59d786

File tree

5 files changed

+177
-2
lines changed

5 files changed

+177
-2
lines changed

device_plugins/install_operator.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ spec:
1919
installPlanApproval: Automatic
2020
name: intel-device-plugins-operator
2121
source: certified-operators
22-
sourceNamespace: openshift-marketplace
23-
startingCSV: intel-device-plugins-operator.v0.29.1
22+
sourceNamespace: openshift-marketplace

playbooks/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Intel Technology Enabling Ansible Playbooks
2+
3+
## Overview
4+
This directory contains Ansible playbooks designed to automate the deployment and configuration of Intel technologies on Red Hat OpenShift clusters. These playbooks streamline the Intel feature provisioning and validation process on OpenShift environments.
5+
6+
## Prerequisites
7+
Before running the playbook, ensure the following prerequisites are met:
8+
- Provisioned RHOCP Cluster
9+
- Red Hat Enterprise Linux (RHEL) system with [Ansible](https://docs.ansible.com/ansible/2.9/installation_guide/intro_installation.html#installing-ansible-on-rhel-centos-or-fedora) installed and configured with a `kubeconfig` to connect to your RHOCP cluster.
10+
11+
## Run the Playbook
12+
13+
To run the ansible playbook, clone this repository to your RHEL system. Navigate to the directory containing the playbook.
14+
15+
```bash
16+
git clone https://github.com/intel/intel-technology-enabling-for-openshift.git
17+
18+
cd intel-technology-enabling-for-openshift/
19+
20+
ansible-playbook playbooks/intel_ocp_provisioning.yaml
21+
```
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
- name: Create global OperatorGroup in openshift-operators namespace
2+
k8s:
3+
state: present
4+
definition:
5+
apiVersion: operators.coreos.com/v1alpha2
6+
kind: OperatorGroup
7+
metadata:
8+
name: global-operators
9+
namespace: openshift-operators
10+
11+
- name: Create Intel Device Plugins Operator Subscription
12+
k8s:
13+
state: present
14+
definition:
15+
apiVersion: operators.coreos.com/v1alpha1
16+
kind: Subscription
17+
metadata:
18+
labels:
19+
operators.coreos.com/intel-device-plugins-operator.openshiftoperators: ""
20+
name: intel-device-plugins-operator
21+
namespace: openshift-operators
22+
spec:
23+
channel: alpha
24+
installPlanApproval: Automatic
25+
name: intel-device-plugins-operator
26+
source: certified-operators
27+
sourceNamespace: openshift-marketplace

playbooks/install_nfd_operator.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
- name: Create namespace for Node Feature Discovery
2+
k8s:
3+
state: present
4+
definition:
5+
apiVersion: v1
6+
kind: Namespace
7+
metadata:
8+
name: openshift-nfd
9+
10+
- name: Create operator group for Node Feature Discovery
11+
k8s:
12+
state: present
13+
definition:
14+
apiVersion: operators.coreos.com/v1
15+
kind: OperatorGroup
16+
metadata:
17+
generateName: openshift-nfd-
18+
name: openshift-nfd
19+
namespace: openshift-nfd
20+
spec:
21+
targetNamespaces:
22+
- openshift-nfd
23+
24+
- name: Subscribe to Node Feature Discovery operator
25+
k8s:
26+
state: present
27+
definition:
28+
apiVersion: operators.coreos.com/v1alpha1
29+
kind: Subscription
30+
metadata:
31+
name: nfd
32+
namespace: openshift-nfd
33+
spec:
34+
channel: "stable"
35+
installPlanApproval: Automatic
36+
name: nfd
37+
source: redhat-operators
38+
sourceNamespace: openshift-marketplace

playbooks/intel_ocp_provisioning.yaml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
- hosts: localhost
2+
gather_facts: no
3+
vars:
4+
kubeconfig_path: "~/.kube/config"
5+
environment:
6+
KUBECONFIG: "{{ kubeconfig_path }}"
7+
vars_prompt:
8+
- name: "install_operators"
9+
prompt: "Do you want to install operators? 'Yes' to install NFD Operator and Intel Device Plugins Operator, or 'No' to skip"
10+
private: no
11+
- name: "validation_feature"
12+
prompt: "Which Intel feature do you want to validate? Enter 1 for Intel SGX, 2 for Intel QAT, 3 for Intel DSA, 4 for Intel GPU"
13+
private: no
14+
15+
tasks:
16+
- name: Validate Inputs
17+
block:
18+
- name: Invalid Install Operators Input
19+
fail:
20+
msg: "Invalid input for Install Operators. Please enter a valid option for Install Operators (Yes/No)."
21+
when: install_operators not in ["Yes", "No"]
22+
- name: Invalid Validation Feature Input
23+
fail:
24+
msg: "Invalid input for validation feature. Please enter a valid option (1-4)."
25+
when: validation_feature not in ["1", "2", "3", "4"]
26+
27+
- name: Install Operators
28+
block:
29+
- name: NFD - Install NFD Operator
30+
include_tasks: install_nfd_operator.yaml
31+
- name: IDPO - Install Intel Device Plugins Operator
32+
include_tasks: install_device_plugins_operator.yaml
33+
- name: NFD - Wait until the nfd-operator-controller Deployment is available
34+
k8s_info:
35+
kind: Deployment
36+
wait: yes
37+
name: nfd-controller-manager
38+
namespace: openshift-nfd
39+
wait_condition:
40+
type: Available
41+
status: 'True'
42+
- name: NFD - Create NFD discovery CR
43+
k8s:
44+
state: present
45+
definition: '{{ item }}'
46+
wait: yes
47+
wait_condition:
48+
type: Available
49+
status: 'False'
50+
with_items: '{{ lookup("url", "https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/nfd/node-feature-discovery-openshift.yaml", split_lines=False) | from_yaml_all | list }}'
51+
when: (item is not none)
52+
- name: NFD - Create NFD rules instance CR
53+
k8s:
54+
state: present
55+
definition: '{{ item }}'
56+
wait: yes
57+
with_items: '{{ lookup("url", "https://raw.githubusercontent.com/intel/intel-technology-enabling-for-openshift/main/nfd/node-feature-rules-openshift.yaml", split_lines=False) | from_yaml_all | list }}'
58+
when: (item is not none)
59+
- name: IDPO - Wait until the inteldeviceplugins-controller-manager Deployment is available
60+
k8s_info:
61+
kind: Deployment
62+
name: inteldeviceplugins-controller-manager
63+
namespace: openshift-operators
64+
wait: yes
65+
wait_condition:
66+
type: Available
67+
status: 'True'
68+
reason: MinimumReplicasAvailable
69+
when: install_operators == "Yes"
70+
71+
- name: Skip Operator Installation
72+
debug:
73+
msg: "Skipping operator installation as per user input."
74+
when: install_operators == "No"
75+
76+
- name: Validate Intel SGX
77+
include_tasks: validate_sgx.yaml
78+
when: validation_feature == "1"
79+
80+
- name: Validate Intel QAT
81+
include_tasks: validate_gpu.yaml
82+
when: validation_feature == "2"
83+
84+
- name: Validate Intel DSA
85+
include_tasks: validate_qat.yaml
86+
when: validation_feature == "3"
87+
88+
- name: Validate Intel GPU
89+
include_tasks: validate_dsa.yaml
90+
when: validation_feature == "4"

0 commit comments

Comments
 (0)