简介

IBM LSF Suite for Workgroup 是一个集成的工作负载管理解决方案,通过 Ansible 自动化部署工具简化了 LSF 集群的安装和配置过程。本文将详细介绍 10.2.0.15 版本的部署步骤,包括一个关键的配置修正

前提条件

  • 一台作为 deployer 的主机,为 Rocky Linux 8.10,加域,挂载NFS
  • 目标集群的主机列表,均为 Rocky Linux 8.10,加域,挂载NFS
  • 主机之间的 SSH 免密登录配置
  • 安装包 lsfswg10.2.0.15-x86_64.bin

部署步骤

第一步:解压安装包

首先,赋予安装包执行权限并运行:

1
2
chmod +x lsfswg10.2.0.15-x86_64.bin
./lsfswg10.2.0.15-x86_64.bin

安装完成后,会显示以下信息:

1
2
3
4
5
6
7
8
LSF Suite for Workgroup 10.2.0.15 deployer installed

To deploy LSF Suite to a cluster:
 - Change directory to "/opt/ibm/lsf_installer/playbook"
 - Edit the "lsf-inventory" file with lists of machines and their roles in the cluster
 - Edit the "lsf-config.yml" file with required parameters
 - Run "ansible-playbook -i lsf-inventory lsf-predeploy-test.yml"
 - Run "ansible-playbook -i lsf-inventory lsf-deploy.yml"

第二步:修复 Ansible 变量问题(重要)

[!CAUTION] 小编发现 IBM LSF 团队在 playbook 中使用了错误的变量 ansible_distribution,这会导致在某些 RHEL 派生系统(如 Rocky Linux、AlmaLinux)上部署失败。应该使用 ansible_os_family 来检查是否为 RHEL 派生操作系统。

执行以下命令修复此问题:

1
2
cd /opt/ibm/lsf_installer/playbook
grep -r -E 'ansible_distribution[^_a-z]' | awk -F ':' '{print $1}' | sort -u | xargs -ti sed -i 's/\bansible_distribution\b/ansible_os_family/g' {}

为什么需要这个修复?

变量 说明 示例值
ansible_distribution 返回具体的 Linux 发行版名称 CentOS, Rocky, AlmaLinux, RedHat
ansible_os_family 返回操作系统家族 RedHat, Debian, Suse

原始 playbook 检查 ansible_distribution == "RedHat",但这无法正确识别 Rocky Linux、AlmaLinux 等 RHEL 派生系统。使用 ansible_os_family == "RedHat" 可以正确匹配所有 RHEL 派生系统。

第三步:配置 group_vars

编辑 group variables 文件:

1
vi /opt/ibm/lsf_installer/playbook/group_vars/all

设置 deployer 主机名:

1
deployer_hostname: rd-172-31-0-160

请将 rd-172-31-0-160 替换为您实际的 deployer 主机名。

第四步:配置集群主机清单

编辑 inventory 文件,定义集群中各主机的角色:

1
vi /opt/ibm/lsf_installer/playbook/lsf-inventory

配置示例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[local]
localhost

[LSF_Masters]
rd-172-31-0-160
rd-172-31-0-161

[LSF_Servers]
rd-172-31-0-163

[LSF_Clients]
rd-172-31-0-162

[GUI_Hosts]
rd-172-31-0-160

# ... snipet ommited ...

第五步:配置部署参数

编辑配置文件,设置必要的部署参数:

1
vi /opt/ibm/lsf_installer/playbook/lsf-config.yml

根据您的环境需求配置相关参数,如集群名称、共享目录等。

第六步:运行预部署测试

在正式部署前,运行预部署测试以验证配置:

1
2
cd /opt/ibm/lsf_installer/playbook
ansible-playbook -i lsf-inventory lsf-predeploy-test.yml

此步骤会检查:

  • 主机连通性
  • SSH 配置
  • 系统要求
  • 配置参数有效性

第七步:执行正式部署

预部署测试通过后,执行正式部署:

1
ansible-playbook -i lsf-inventory lsf-deploy.yml

部署过程可能需要一些时间,请耐心等待。

部署后验证

image-20251210144958087

部署完成后,可以通过以下命令验证 LSF 集群状态:

1
2
3
4
5
6
7
8
9
10
11
12
# 查看集群状态
lsid

# 查看主机状态
bhosts

# 查看队列状态
bqueues

# 提交测试作业
bsub -q normal sleep 60
bjobs

常见问题

预部署测试失败

如果 lsf-predeploy-test.yml 失败,请检查:

  1. SSH 免密登录是否配置正确
  2. 目标主机是否满足系统要求
  3. lsf-inventorylsf-config.yml 配置是否正确

部署过程中断

如果部署中途失败,可以修复问题后重新运行 lsf-deploy.yml,Ansible 会跳过已完成的步骤。

总结

本文介绍了 IBM LSF Suite for Workgroup 10.2.0.15 的完整部署流程,特别强调了修复 ansible_distribution 变量问题的重要性。通过遵循这些步骤,您可以成功地在 RHEL 派生系统上部署 LSF 集群。

参考资料

  1. IBM Documentation - LSF Suite for Workgroup
  2. Ansible Documentation - ansible_os_family