From 079d2b9b2667993a8afaa1f754ebd9d75dc55ed261f32d9db2775c931c078407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 7 Feb 2025 18:24:37 +0100 Subject: [PATCH] Sync from SUSE:SLFO:Main ansible-sap-infrastructure revision e5ef425deb3226ad452936e8ad682997 --- .gitattributes | 23 ++++ _service | 3 + ansible-sap-infrastructure-1.1.1.tar.gz | 3 + ansible-sap-infrastructure.changes | 5 + ansible-sap-infrastructure.spec | 133 ++++++++++++++++++++++++ 5 files changed, 167 insertions(+) create mode 100644 .gitattributes create mode 100644 _service create mode 100644 ansible-sap-infrastructure-1.1.1.tar.gz create mode 100644 ansible-sap-infrastructure.changes create mode 100644 ansible-sap-infrastructure.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/_service b/_service new file mode 100644 index 0000000..e2ab7b1 --- /dev/null +++ b/_service @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/ansible-sap-infrastructure-1.1.1.tar.gz b/ansible-sap-infrastructure-1.1.1.tar.gz new file mode 100644 index 0000000..c90fced --- /dev/null +++ b/ansible-sap-infrastructure-1.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:792208018271e7b310c13d4155112f393ca5b22c113e4f8dba32fe492f2b5b3f +size 178565 diff --git a/ansible-sap-infrastructure.changes b/ansible-sap-infrastructure.changes new file mode 100644 index 0000000..bc7d15e --- /dev/null +++ b/ansible-sap-infrastructure.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Fri Jan 20 09:00:00 UTC 2025 - Marcel Mamula + +- 1.1.1 + - Initial release diff --git a/ansible-sap-infrastructure.spec b/ansible-sap-infrastructure.spec new file mode 100644 index 0000000..fccc2d3 --- /dev/null +++ b/ansible-sap-infrastructure.spec @@ -0,0 +1,133 @@ +# +# spec file for package ansible-sap-infrastructure +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + +%define ansible_collection_name sap_infrastructure +%define ansible_roles_to_remove "sap_hypervisor_node_preconfigure sap_vm_preconfigure sap_vm_verify" +%define ansible_collection_path %{_datadir}/ansible/collections/ansible_collections/suse/%{ansible_collection_name} + + +Name: ansible-sap-infrastructure +Summary: Ansible collection suse.sap_infrastructure for SAP Automation +License: Apache-2.0 +Version: 1.1.1 +Release: 0 +URL: https://github.com/SUSE/community.sap_infrastructure/ +Source: %{url}archive/refs/tags/%{version}-suse.tar.gz#/%{name}-%{version}.tar.gz + +BuildArch: noarch + + +# Python macros are required for python detection +BuildRequires: python-rpm-macros + +# Minimum python version +%{?sle15_python_module_pythons} +BuildRequires: %{python_module base >= 3.11} +Requires: %{python_module base >= 3.11} + + +# Select correct supported Ansible +%if 0%{?suse_version} >= 1600 +Requires: ansible-core +Requires: ansible +BuildRequires: ansible-core +BuildRequires: ansible +%else +# Only Ansible 9 is supported on SLES 15 +Requires: ansible-core-2.16 +Requires: ansible-9 +BuildRequires: ansible-core-2.16 +BuildRequires: ansible-9 +%endif + +# Do not check any files in collections for requires +%global __requires_exclude_from ^%{python311_sitelib}/.*$ + + +%description +This package provides a Ansible collection suse.sap_infrastructure. + +It automates the provisioning of SAP infrastructure across various platforms: +- AWS EC2 Virtual Server instances +- Google Cloud Compute Engine Virtual Machines +- IBM Cloud, Intel Virtual Servers +- IBM Cloud, Power Virtual Servers +- Microsoft Azure Virtual Machines +- IBM PowerVM Virtual Machines + +Ensure that you install all required packages, python modules and collections. +https://github.com/SUSE/community.sap_infrastructure/tree/main/roles/sap_vm_provision#requirements + +Package and collection dependencies are not installed along with this package! + + +%prep +# Extract tarball +cd %{_builddir} +tar -xzf %{_sourcedir}/%{name}-%{version}.tar.gz --strip-components=1 + + +%build +cd %{_builddir} +# Remove unsupported roles before building collection +for role in $(echo %{ansible_roles_to_remove}); do + rm -rf %{_builddir}/roles/$role +done +ansible-galaxy collection build --output-path %{_builddir} + + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_datadir}/ansible/collections +mkdir -p %{buildroot}%{_datadir}/ansible/roles/ + +# ansible-galaxy always appends ansible_collections folder into collections path +ansible-galaxy collection install --force %{_builddir}/suse-%{ansible_collection_name}-%{version}.tar.gz \ + --collections-path %{buildroot}%{_datadir}/ansible/collections + + +%post +# Loop through roles in collection and create symlinks under %{_datadir}/ansible/roles/ +# Installed community collection will take precedence over role symlinks. +for role in %{ansible_collection_path}/roles/*; do + role_name=$(basename "$role") + if [ ! -e %{_datadir}/ansible/roles/community.%{ansible_collection_name}.${role_name} ]; then + ln -sf %{ansible_collection_path}/roles/${role_name} \ + %{_datadir}/ansible/roles/community.%{ansible_collection_name}.${role_name} + fi +done + + +%postun +# Loop through roles in %{_datadir}/ansible/roles/ and remove those that link to collection +if [ "$1" -eq 0 ]; then + for role in %{_datadir}/ansible/roles/community.%{ansible_collection_name}.*; do + if [ -L "$role" ]; then + target=$(readlink "$role") + if ( [ -e "$target" ] && [ "$target" = "%{ansible_collection_path}/roles/$(basename "$role")" ] ) || [ ! -e "$target" ]; then + rm -f "$role" + fi + fi + done +fi + + +%files +%{_datadir}/ansible/collections/ +%{_datadir}/ansible/roles/ + +%changelog