Skip to content

Commit f2f1359

Browse files
committed
WIP prepare BMaaS
Signed-off-by: Dmitry Tantsur <dtantsur@protonmail.com>
1 parent 5c33bf9 commit f2f1359

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed

install-oras.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
- name: Install ORAS CLI
3+
hosts: localhost
4+
become: yes
5+
roles:
6+
- oras

prepare-bmaas.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
echo "Installing ORAS CLI for bare-metal as a service preparation..."
8+
9+
ansible-playbook -i localhost, -c local "${SCRIPT_DIR}/install-oras.yml"
10+
11+
echo "ORAS CLI installation completed."

roles/oras/defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
oras_version: "1.2.2"
3+
oras_install_dir: "/usr/local/bin"
4+
oras_download_dir: "/tmp"
5+
oras_architecture: "{{ 'arm64' if ansible_architecture == 'aarch64' else 'amd64' }}"

roles/oras/meta/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
galaxy_info:
3+
author: dev-scripts
4+
description: Install ORAS CLI
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: []

roles/oras/tasks/main.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
- name: Create temporary download directory
3+
ansible.builtin.file:
4+
path: "{{ oras_download_dir }}/oras-install"
5+
state: directory
6+
mode: '0755'
7+
8+
- name: Download ORAS CLI
9+
ansible.builtin.get_url:
10+
url: "https://github.com/oras-project/oras/releases/download/v{{ oras_version }}/oras_{{ oras_version }}_linux_{{ oras_architecture }}.tar.gz"
11+
dest: "{{ oras_download_dir }}/oras_{{ oras_version }}_linux_{{ oras_architecture }}.tar.gz"
12+
mode: '0644'
13+
14+
- name: Extract ORAS CLI
15+
ansible.builtin.unarchive:
16+
src: "{{ oras_download_dir }}/oras_{{ oras_version }}_linux_{{ oras_architecture }}.tar.gz"
17+
dest: "{{ oras_download_dir }}/oras-install"
18+
remote_src: yes
19+
20+
- name: Install ORAS CLI binary
21+
ansible.builtin.copy:
22+
src: "{{ oras_download_dir }}/oras-install/oras"
23+
dest: "{{ oras_install_dir }}/oras"
24+
mode: '0755'
25+
remote_src: yes
26+
become: yes
27+
28+
- name: Clean up download files
29+
ansible.builtin.file:
30+
path: "{{ item }}"
31+
state: absent
32+
loop:
33+
- "{{ oras_download_dir }}/oras_{{ oras_version }}_linux_{{ oras_architecture }}.tar.gz"
34+
- "{{ oras_download_dir }}/oras-install"
35+
36+
- name: Verify ORAS CLI installation
37+
ansible.builtin.command: "{{ oras_install_dir }}/oras version"
38+
register: oras_version_output
39+
changed_when: false
40+
41+
- name: Display ORAS CLI version
42+
ansible.builtin.debug:
43+
msg: "ORAS CLI installed successfully: {{ oras_version_output.stdout }}"

0 commit comments

Comments
 (0)