第 2 章 为 SAP 安装 Ansible Engine 和 RHEL 系统角色
使用以下步骤为 SAP 软件包或集合安装 Ansible Core 和 RHEL 系统角色。
要在 Red Hat Satellite 系统上安装软件包,请不要使用普通 dnf 命令,而是请按照 如何在 Red Hat Satellite 6 中安装和更新软件包中的说明进行操作?
步骤
安装 Ansible Core:
dnf install ansible-core
# dnf install ansible-coreCopy to Clipboard Copied! Toggle word wrap Toggle overflow 继续执行第 2 步来安装 RHEL 软件包
rhel-system-roles-sap或第 3 步来安装 Automation Hub 集合redhat.sap_install。要安装 RHEL 软件包
rhel-system-roles-sap:使用 Red Hat Subscription Manager 启用 RHEL for SAP Solutions 存储库:
subscription-manager repos --enable=rhel-$(rpm -E %rhel)-for-$(uname -m)-sap-solutions-rpms
# subscription-manager repos --enable=rhel-$(rpm -E %rhel)-for-$(uname -m)-sap-solutions-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow 为 SAP 安装 RHEL 系统角色:
dnf install rhel-system-roles-sap
# dnf install rhel-system-roles-sapCopy to Clipboard Copied! Toggle word wrap Toggle overflow rhel-system-roles-sap软件包安装到/usr/share/ansible/roles/<role>,其中 <role> 是单个角色的名称,如sap_hana_preconfigure。每个角色都包含一个README.md文件,它解释了所有变量以及如何使用角色。
要安装 Automation Hub 集合
redhat.sap_install,您可以直接从 Automation Hub 安装集合,或者首先下载它,然后从下载的文件中安装它。要从 Automation Hub 直接安装集合,请按照 此页面 中的说明操作。基本步骤是:
- 在此页面中复制离线令牌、服务器 URL 和 SSO URL,并在同一个 页面上 记录 Server URL 和 SSO URL。如果需要(如因为过期),请重新创建令牌。
根据 本章中 的说明,使用这些值配置文件
/etc/ansible/ansible.cfg。使用变量url的 Server URL、变量auth_url的 SSO URL,以及变量令牌的 Offline令牌,如下例所示(用实际令牌替换 dummy 令牌):Copy to Clipboard Copied! Toggle word wrap Toggle overflow 作为将使用集合的用户身份运行以下命令来安装集合(将运行 playbook 的用户)来在受管节点上安装软件或配置设置:
ansible-galaxy collection install redhat.sap_install
# ansible-galaxy collection install redhat.sap_installCopy to Clipboard Copied! Toggle word wrap Toggle overflow 这会将集合安装到用户的默认位置(递归创建目录),即
~/.ansible/collections/ansible_collections/redhat/sap_install。
要从 Automation Hub 下载集合并安装它,请执行以下步骤:
从 此页面 下载集合 tar 文件(使用
Download tarball链接),然后以将使用集合的用户身份运行以下命令:ansible-galaxy collection install ./redhat-sap_install-1.2.1.tar.gz
# ansible-galaxy collection install ./redhat-sap_install-1.2.1.tar.gzCopy to Clipboard Copied! Toggle word wrap Toggle overflow 这也会将集合安装到用户的默认位置,如前面所述。
每个角色子目录中的文件README.md包含在sap_install下,如roles/sap_general_preconfigure,其中包含每个角色的文档。