你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
在 SAP 部署自动化框架(SDAF)中,我们认识到适应性和自定义的重要性,以满足各种部署的独特需求。 本文档介绍扩展框架功能的方法,确保它符合你的特定要求。
扩展框架的一些常见方案包括:
分叉源代码存储库:扩展 SDAF 的一种方法是分叉源代码存储库。 此方法可让你灵活地在代码的分支版本中进行定制修改。 通过执行此作,你可以控制框架的核心功能,使你可以根据部署目标精确定制它。
将阶段添加到 SAP 配置管道:自定义的另一种方法是将阶段添加到 SAP 配置管道。 此方法允许将部署工作流不可或缺的特定过程或步骤集成到自动化管道中。
简化的扩展性:此功能允许你轻松地将现有的 Ansible playbook 直接合并到 SDAF 中。 通过使用此功能,可以将 Ansible 自动化脚本与框架无缝集成,从而进一步增强其多功能性。
配置扩展性:此功能允许通过添加自定义存储库、包、内核参数、逻辑卷、装载和导出来扩展框架的配置功能,而无需编写任何代码。
在整个文档中,我们提供了有关每个扩展性选项的综合指导,确保你具备根据特定部署需求定制 SAP 部署自动化框架所需的知识和工具。
注释
如果你要创建源代码存储库的分支,则必须维护代码分支。 每当发布新的 SDAF 代码库时,还必须将源代码存储库中的更改合并到代码分支中。
执行自己的 Ansible playbook 作为 Azure DevOps 业务流程的一部分
可以实现您自己的 Ansible 剧本,这些剧本会自动作为 Azure DevOps “OS 配置和 SAP 安装”管道的一部分被调用。
Ansible 剧本必须存放在配置存储库根文件夹中一个名为“Ansible”的文件夹内。 它们使用与 SDAF playbook 相同的参数文件调用,因此你可以访问所有配置。
必须根据以下命名约定为 Ansible playbook 命名:
“Playbook name_pre”表示在 SDAF playbook 之前运行的 playbook,“Playbook name_post”表示在 SDAF playbook 之后运行的 playbook。
Playbook 名称 | “pre”(前置)任务的 playbook 名称 | “post”(后置)任务的 playbook 名称 | DESCRIPTION |
---|---|---|---|
playbook_01_os_base_config.yaml |
playbook_01_os_base_config_pre.yaml |
playbook_01_os_base_config_post.yaml |
基本操作系统配置 |
playbook_02_os_sap_specific_config.yaml |
playbook_02_os_sap_specific_config_pre.yaml |
playbook_02_os_sap_specific_config_post.yaml |
SAP 特定配置 |
playbook_03_bom_processing.yaml |
playbook_03_bom_processing_pre.yaml |
playbook_03_bom_processing_post.yaml |
材料处理帐单 |
playbook_04_00_00_db_install.yaml |
playbook_04_00_00_db_install_pre.yaml |
playbook_04_00_00_db_install_post.yaml |
数据库服务器安装 |
playbook_04_00_01_db_ha.yaml |
playbook_04_00_01_db_ha_pre.yaml |
playbook_04_00_01_db_ha_post.yaml |
数据库高可用性配置 |
playbook_05_00_00_sap_scs_install.yaml |
playbook_05_00_00_sap_scs_install_pre.yaml |
playbook_05_00_00_sap_scs_install_post.yaml |
中心服务安装和高可用性配置 |
playbook_05_01_sap_dbload.yaml |
playbook_05_01_sap_dbload_pre.yaml |
playbook_05_01_sap_dbload_post.yaml |
数据库加载 |
playbook_05_02_sap_pas_install.yaml |
playbook_05_02_sap_pas_install_pre.yaml |
playbook_05_02_sap_pas_install_post.yaml |
主应用程序服务器安装 |
playbook_05_03_sap_app_install.yaml |
playbook_05_03_sap_app_install_pre.yaml |
playbook_05_03_sap_app_install_post.yaml |
应用程序服务器安装 |
playbook_05_04_sap_web_install.yaml |
playbook_05_04_sap_web_install_pre.yaml |
playbook_05_04_sap_web_install_post.yaml |
Web 调度程序安装 |
playbook_08_00_00_post_configuration_actions.yaml |
playbook_08_00_00_post_configuration_actions_pre.yml |
playbook_08_00_00_post_configuration_actions_post.yml |
配置后操作 |
注释
playbook_08_00_00_post_configuration_actions.yaml 步骤不涉及 SDAF 提供的角色/任务,它只是在 SDAF 完成安装和配置后为 _pre
和 _post
挂钩提供方便。
示例 Ansible playbook
---
# /*---------------------------------------------------------------------------8
# | |
# | Run commands on all remote hosts |
# | |
# +------------------------------------4--------------------------------------*/
- hosts: "{{ sap_sid | upper }}_DB :
{{ sap_sid | upper }}_SCS :
{{ sap_sid | upper }}_ERS :
{{ sap_sid | upper }}_PAS :
{{ sap_sid | upper }}_APP :
{{ sap_sid | upper }}_WEB"
name: "Examples on how to run commands on remote hosts"
gather_facts: true
tasks:
- name: "Calculate information about the OS distribution"
ansible.builtin.set_fact:
distro_family: "{{ ansible_os_family | upper }}"
distribution_id: "{{ ansible_distribution | lower ~ ansible_distribution_major_version }}"
distribution_full_id: "{{ ansible_distribution | lower ~ ansible_distribution_version }}"
- name: "Show information"
ansible.builtin.debug:
msg:
- "Distro family: {{ distro_family }}"
- "Distribution id: {{ distribution_id }}"
- "Distribution full id: {{ distribution_full_id }}"
- name: "Show how to run a command on all remote host"
ansible.builtin.command: "whoami"
register: whoami_results
- name: "Show results"
ansible.builtin.debug:
var: whoami_results
verbosity: 0
- name: "Show how to run a command on just the 'SCS' and 'ERS' hosts"
ansible.builtin.command: "whoami"
register: whoami_results
when:
- "'scs' in supported_tiers or 'ers' in supported_tiers "
...
更新用户和组 ID (Linux)
如果要更改框架使用的用户和组 ID,可以将以下部分添加到 sap-parameters.yaml 文件。
# User and group IDs
sapadm_uid: "3000"
sidadm_uid: "3100"
sapinst_gid: "300"
sapsys_gid: "400"
可以使用 configuration_settings
变量来让 Terraform 将此节添加到 sap-parameters.yaml 文件中。
configuration_settings = {
sapadm_uid = "3000",
sidadm_uid = "3100",
sapinst_gid = "300",
sapsys_gid = "400"
}
为实例添加自定义主机名 (Linux)
除了框架生成的主机名之外,还可以为 SAP 部署中的实例添加自定义主机名。 为此,请将以下部分添加到 sap-parameters.yaml 文件。
custom_scs_virtual_hostname: "myscshostname"
custom_ers_virtual_hostname: "myershostname"
custom_db_virtual_hostname: "mydbhostname"
custom_pas_virtual_hostname: "mypashostname"
可以使用 configuration_settings
变量来让 Terraform 将此节添加到 sap-parameters.yaml 文件中。
configuration_settings = {
custom_scs_virtual_hostname = "myscshostname",
custom_ers_virtual_hostname = "myershostname",
custom_db_virtual_hostname = "mydbhostname",
custom_pas_virtual_hostname = "mypashostname"
}
添加自定义存储库 (Linux)
如果需要将额外的 Linux 包存储库注册到框架部署的虚拟机,可以将以下部分添加到 sap-parameters.yaml 文件。
在此示例中,存储库“epel”在运行 RedHat 8.2 的 SAP 部署中的所有主机上注册。
custom_repos:
redhat8.2:
- { tier: 'ha', repo: 'epel', url: 'https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm', state: 'present' }
添加自定义包 (Linux)
如果需要将更多 Linux 包安装到框架部署的虚拟机,可以将以下部分添加到 sap-parameters.yaml 文件。
在此示例中,包“openssl”安装在 SAP 部署中运行 SUSE Enterprise Linux for SAP Applications 版本 15.3 的所有主机上。
custom_packages:
sles_sap15.3:
- { tier: 'os', package: 'openssl', node_tier: 'all', state: 'present' }
如果要在特定服务器类型(app
、ers
、pas
、scs
、hana
)上安装包,可以将以下部分添加到 sap-parameters.yaml 文件中。
custom_packages:
sles_sap15.3:
- { tier: 'ha', package: 'pacemaker', node_tier: 'hana', state: 'present' }
添加自定义内核参数 (Linux)
可以通过将自定义内核参数添加到 SDAF 安装来扩展 SAP 部署自动化框架。
将以下内容添加到 sap-parameters.yaml 文件中时,SAP 部署中所有主机上的参数“fs.suid_dumpable”将被设置为 0。
custom_parameters:
common:
- { tier: 'os', node_tier: 'all', name: 'fs.suid_dumpable', value: '0', state: 'present' }
添加自定义服务 (Linux)
如果需要管理框架部署的虚拟机上的其他服务,可以将以下部分添加到 sap-parameters.yaml 文件。
在此示例中,SAP 部署中运行 RedHat 7.x 的所有主机上停止并禁用了“防火墙”服务。
custom_services:
redhat7:
- { tier: 'os', service: 'firewalld', node_tier: 'all', state: 'stopped' }
- { tier: 'os', service: 'firewalld', node_tier: 'all', state: 'disabled' }
添加自定义逻辑卷 (Linux)
可以通过在 SDAF 安装中添加基于额外磁盘的逻辑卷来扩展 SAP 部署自动化框架。
将以下部分添加到 sap-parameters.yaml 文件时,将在 SAP 部署中包含名为“custom”的磁盘的所有虚拟机上创建逻辑卷“lv_custom”。 文件系统装载在逻辑卷上,并在“/custompath”上可用。
custom_logical_volumes:
- tier: 'sapos'
node_tier: 'all'
vg: 'vg_custom'
lv: 'lv_custom'
size: '100%FREE'
fstype: 'xfs'
path: '/custompath'
注释
若要使用此功能,需要向一个或多个虚拟机添加一个名为“custom”的额外磁盘。 有关详细信息,请参阅 自定义磁盘大小调整。
可以使用 configuration_settings
变量来让 Terraform 将此节添加到 sap-parameters.yaml 文件中。
configuration_settings = {
custom_logical_volumes = [
{
tier = 'sapos'
node_tier = 'all'
vg = 'vg_custom'
lv = 'lv_custom'
size = '100%FREE'
fstype = 'xfs'
path = '/custompath'
}
]
}
添加自定义装载 (Linux)
可以通过在安装中装载额外的装入点来扩展 SAP 部署自动化框架。
将以下部分添加到 sap-parameters.yaml 文件时,文件系统“/usr/custom”将从“xxxxxxxxx.file.core.windows.net:/xxxxxxxxx/custom”上的 NFS 共享装载。
custom_mounts:
- path: "/usr/custom"
opts: "vers=4,minorversion=1,sec=sys"
mount: "xxxxxxxxx.file.core.windows.net:/xxxxxxxx/custom"
target_nodes: "scs,pas,app"
target_nodes
属性用于定义要为哪些节点定义装载。 如果你想要为所有节点定义装载,请使用“all”。
可以使用 configuration_settings
变量来让 Terraform 将此节添加到 sap-parameters.yaml 文件中。
configuration_settings = {
custom_mounts = [
{
path = "/usr/custom",
opts = "vers=4,minorversion=1,sec=sys",
mount = "xxxxxxxxx.file.core.windows.net:/xxxxxxxx/custom",
target_nodes = "scs,pas,app"
}
]
}
添加自定义导出 (Linux)
可以通过添加要从 Central Services 虚拟机导出的额外文件夹来扩展 SAP 部署自动化框架。
将以下部分添加到 sap-parameters.yaml 文件时,文件系统“/usr/custom”将从 Central Services 虚拟机导出,并通过 NFS 提供。
custom_exports:
path: "/usr/custom"
可以使用 configuration_settings
变量来让 Terraform 将此节添加到 sap-parameters.yaml 文件中。
configuration_settings = {
custom_mounts = [
{
path = "/usr/custom",
}
]
}
注释
这仅适用于NFS_Provider设置为“NONE”的部署,因为这使得中央服务服务器成为 NFS 服务器。
自定义条带大小 (Linux)
如果您希望调整框架在创建磁盘时使用的条带尺寸,可以将以下部分添加到 sap-parameters.yaml 文件中,并设置您想要的值。
# User and group IDs
hana_data_stripe_size: 256
hana_log_stripe_size: 64
db2_log_stripe_size: 64
db2_data_stripe_size: 256
db2_temp_stripe_size: 128
sybase_data_stripe_size: 256
sybase_log_stripe_size: 64
sybase_temp_stripe_size: 128
oracle_data_stripe_size: 256
oracle_log_stripe_size: 128
自定义卷大小 (Linux)
如果你想要指定框架使用的默认卷大小,可将以下节添加到 sap-parameters.yaml 文件中并设置所需的值。
sapmnt_volume_size: 32g
usrsap_volume_size: 32g
hanashared_volume_size: 32g