Skip to content

Commit a10f0e5

Browse files
committed
Configure the OCI registry for BMaaS
Generated-By: Claude Code Signed-off-by: Dmitry Tantsur <[email protected]>
1 parent 05dfeb5 commit a10f0e5

File tree

6 files changed

+93
-9
lines changed

6 files changed

+93
-9
lines changed

install-bmaas.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Setup Bare-Metal as a Service (BMaaS)
3+
hosts: localhost
4+
roles:
5+
- bmaas

install-oras.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

prepare-bmaas.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ set -euo pipefail
44

55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
66

7-
echo "Installing ORAS CLI for bare-metal as a service preparation..."
7+
echo "Setting up bare-metal as a service (BMaaS) configuration..."
88

9-
ansible-playbook -i localhost, -c local "${SCRIPT_DIR}/install-oras.yml"
9+
ansible-playbook -i localhost, -c local "${SCRIPT_DIR}/install-bmaas.yml"
1010

11-
echo "ORAS CLI installation completed."
11+
echo "BMaaS setup completed successfully."

roles/bmaas/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bmaas_service_account_name: bmaas-images
3+
bmaas_namespace: openshift-machine-api

roles/bmaas/meta/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
galaxy_info:
3+
author: dev-scripts
4+
description: Configure bare-metal as a service with ORAS CLI and OpenShift registry access
5+
license: Apache-2.0
6+
min_ansible_version: "2.9"
7+
platforms:
8+
- name: EL
9+
versions:
10+
- 8
11+
- 9
12+
- name: Ubuntu
13+
versions:
14+
- focal
15+
- jammy
16+
- name: Fedora
17+
versions:
18+
- 36
19+
- 37
20+
- 38
21+
22+
dependencies:
23+
- oras

roles/bmaas/tasks/main.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
- name: Include oras role
3+
include_role:
4+
name: oras
5+
6+
- name: Create bmaas-images service account
7+
kubernetes.core.k8s:
8+
name: "{{ bmaas_service_account_name }}"
9+
api_version: v1
10+
kind: ServiceAccount
11+
namespace: "{{ bmaas_namespace }}"
12+
state: present
13+
14+
- name: Create ClusterRoleBinding for registry-viewer
15+
kubernetes.core.k8s:
16+
name: "{{ bmaas_service_account_name }}-registry-viewer"
17+
api_version: rbac.authorization.k8s.io/v1
18+
kind: ClusterRoleBinding
19+
state: present
20+
definition:
21+
subjects:
22+
- kind: ServiceAccount
23+
name: "{{ bmaas_service_account_name }}"
24+
namespace: "{{ bmaas_namespace }}"
25+
roleRef:
26+
kind: ClusterRole
27+
name: registry-viewer
28+
apiGroup: rbac.authorization.k8s.io
29+
30+
- name: Create ClusterRoleBinding for registry-editor
31+
kubernetes.core.k8s:
32+
name: "{{ bmaas_service_account_name }}-registry-editor"
33+
api_version: rbac.authorization.k8s.io/v1
34+
kind: ClusterRoleBinding
35+
state: present
36+
definition:
37+
subjects:
38+
- kind: ServiceAccount
39+
name: "{{ bmaas_service_account_name }}"
40+
namespace: "{{ bmaas_namespace }}"
41+
roleRef:
42+
kind: ClusterRole
43+
name: registry-editor
44+
apiGroup: rbac.authorization.k8s.io
45+
46+
- name: Enable default route for OpenShift image registry
47+
kubernetes.core.k8s:
48+
name: cluster
49+
api_version: imageregistry.operator.openshift.io/v1
50+
kind: Config
51+
state: present
52+
merge_type: merge
53+
definition:
54+
spec:
55+
defaultRoute: true
56+
57+
- name: Display service account information
58+
debug:
59+
msg: "BMaaS service account '{{ bmaas_service_account_name }}' created with registry-viewer and registry-editor roles in namespace '{{ bmaas_namespace }}'"

0 commit comments

Comments
 (0)