Automation Suite
2022.4
False
横幅背景图像
Automation Suite 安装指南
上次更新日期 2024年4月24日

使用 uipathctl.sh

uipathctl.sh脚本提供了一种自动化方法,用于将集群升级到较新版本、配置备份、还原集群等,方法是在一个节点上运行。 这些任务的自动化是通过 IT 自动化工具 Ansible 完成的。

要求

Ansible 使用 SSH 机制登录到任何主机节点或计算机以执行任务。

在运行uipathctl.sh脚本之前,您必须执行以下步骤:
  1. 识别 Ansible 主机节点。
  2. 将节点的 SSH 签名添加到已知主机。
  3. 设置 SSH 身份验证方法。
  4. 安装 Ansible 和其他必备工具。

有关说明,请参阅以下部分。

识别 Ansible 主机节点

Ansible 主机节点是安装 Ansible 的计算机。 此计算机必须是服务器节点,以便具有执行集群中所有自动化所需的权限。

在在线安装中,Ansible 主机节点可以是任何服务器节点。

在离线安装中,Ansible 主机节点必须是您在/uipath位置装载 UiPath 捆绑包磁盘的主服务器节点。 如果没有附加 UiPath 捆绑包磁盘的服务器节点,您只需将其他磁盘挂载到任何现有服务器节点,并将其视为 Ansible 主机节点。

将节点的 SSH 签名添加到已知主机

要将节点的 SSH 签名添加到已知主机,请将集群中每个节点的私有 IP 地址添加到 Ansible 主机节点的known_hosts文件中。
在 Ansible 主机节点上运行以下命令,每次将<node-private-ip>替换为集群中每个节点的私有 IP 地址。
ssh-keyscan -H <node-private-ip> >> ~/.ssh/known_hostsssh-keyscan -H <node-private-ip> >> ~/.ssh/known_hosts

设置 SSH 身份验证方法

Ansible 支持两种 SSH 机制:

选项 1:基于密钥的 SSH 身份验证(推荐)

步骤 1:设置 SSH 密钥

SSH 密钥身份验证机制使用私钥和公钥的组合。

确保通过复制所有其他节点上的 Ansible 主机节点的公钥来授予访问权限。

如果您没有 SSH 密钥,则可以通过运行ssh-keygen命令生成一个。
生成 SSH 密钥
您可以使用ssh-keygen命令生成新的 SSH 密钥。 要生成新的 SSH 密钥,只需运行 ssh-keygen 命令并按照说明进行操作。

要生成新的 SSH 密钥,请执行以下步骤:

  1. 使用ssh-keygen命令生成新的 SSH 密钥。
  2. 记下密钥的位置。 默认值为:

    • 公钥: ~/.ssh/id_rsa.pub
    • 私钥: ~/.ssh/id_rsa
  3. 通过复制,授予对所有其他节点上 Ansible 主机节点公钥的访问权限。
授予对每个节点上公钥的访问权限
要授予对公钥的访问权限,请使用ssh-copy-id命令将其复制到集群中的所有节点(包括当前节点)。 如果 SSH 公钥的路径不是~/.ssh/id_rsa.pub ,请确保进行相应的替换。
ssh-copy-id -i ~/.ssh/id_rsa.pub username@node-private-ipssh-copy-id -i ~/.ssh/id_rsa.pub username@node-private-ip

步骤 2:提供对 Ansible 的 SSH 密钥访问权限

Ansible 使用 SSH 机制登录主机并执行所需的安装。 因此,您必须提供对 Ansible 的 SSH 密钥访问权限。

在以下方法中进行选择:

选项 1:使用ssh-agent (推荐)
默认情况下,Ansible 使用 ssh-agent 获取对节点的访问权限。有关 ssh 代理的更多信息,请参阅 ssh 代理手册
要向ssh-agent添加新密钥,请运行以下命令:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsaeval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
选项 2:使用不受保护的私钥
注意: 仅当您的私钥不受密码保护时,才支持此选项。
此方法需要以交互方式使用私钥,方法是将--ansible-private-key参数添加到uipathctl.sh脚本中。 该参数采用私钥的绝对路径并将其用于身份验证。

选项 2:基于密码的 SSH 身份验证

如果选择基于密码的 SSH 身份验证,则必须向uipathctl.sh脚本提供--ansible-ask-password参数。 此参数将提示您提供身份验证密码。

安装 Ansible 和其他必备工具

检查是否已安装 Ansible 和其他必备工具

您必须确保在先前选择的 Ansible 主机节点上安装 Ansible 和以下其他支持工具。

  • ansible (v2.8+)
    要检查是否已安装ansible ,请运行:
    ansible --version &>/dev/null || echo "Error: Ansible is not installed"ansible --version &>/dev/null || echo "Error: Ansible is not installed"
  • ansible-playbook

    要检查是否已安装ansible-playbook ,请运行:
    ansible-playbook --version &>/dev/null || echo "Error: Ansible Playbook is not installed"ansible-playbook --version &>/dev/null || echo "Error: Ansible Playbook is not installed"
  • sshpass – 仅在将密码与--ansible-ask-password参数一起使用进行身份验证时才需要。
    要检查是否已安装sshpass ,请运行:
    sshpass -V &>/dev/null || echo "Error: sshpass is not installed"sshpass -V &>/dev/null || echo "Error: sshpass is not installed"
  • zip – 要检查是否已安装 zip ,请运行:
    zip --version &>/dev/null || echo "Error: zip is not installed"zip --version &>/dev/null || echo "Error: zip is not installed"
    重要提示: 如果上述任何命令出错,则表示您的计算机上未安装目标包。 要安装所有所需工具,请执行以下部分中的步骤。 如果已安装所有工具,则可以跳过这些步骤。

安装 Ansible 和其他必备工具

要安装 Ansible 和其他相关包,请执行以下步骤:

  1. 导航到 Ansible 主机节点上的安装程序文件夹。 安装程序通常位于/opt/UiPathAutomationSuite/{version}文件夹中。
  2. 运行以下命令:
  • 对于在线:

    ./uipathctl.sh install-prerequisites --install-type online --accept-license-agreement./uipathctl.sh install-prerequisites --install-type online --accept-license-agreement
    • 对于离线:
您需要一个额外的 Ansible tarball,其中包含 Ansible 和其他依赖包。 下载 ansible.tar.gz 并将其存储在安装程序文件夹之外的任何位置。 有关下载说明,请参阅 ansible.tar.gz
如果ansible.tar.gz位于其他位置,请更新--offline-prerequisites-bundle参数的绝对位置。
./uipathctl.sh install-prerequisites --install-type offline --offline-prerequisites-bundle ../ansible.tar.gz --accept-license-agreement./uipathctl.sh install-prerequisites --install-type offline --offline-prerequisites-bundle ../ansible.tar.gz --accept-license-agreement

高级 Ansible 配置

生成 Ansible Inventory.ini 文件

在某些情况下,例如在配置备份或升级时,Automation Suite 会自动为 Ansible 生成inventory.ini文件。 但是,在少数情况下,您必须构建inventory.ini文件并将其提供给 Ansible。 例如:
  • 从备份数据还原集群时。 这是因为在还原时,没有运行状况良好的集群可派生inventory.ini
  • 当您要提供特定于每个节点的高级配置(例如用户名和 SSH 密钥)时。

有关更多详细信息,请参阅如何构建自己的清单

以下代码块显示uipathctl.sh脚本可以识别的清单模板。
[FIRST_SERVER]
'10.0.1.1'
[SECONDARY_SERVERS]
'10.0.1.2'
'10.0.1.3'
[AGENTS]
'10.0.1.4'
'10.0.1.5'
[TASKMINING]
'10.0.1.6'
[GPU]
'10.0.1.7'
[all:vars]
ansible_connection=ssh
ansible_timeout=10
ansible_user=admin[FIRST_SERVER]
'10.0.1.1'
[SECONDARY_SERVERS]
'10.0.1.2'
'10.0.1.3'
[AGENTS]
'10.0.1.4'
'10.0.1.5'
[TASKMINING]
'10.0.1.6'
[GPU]
'10.0.1.7'
[all:vars]
ansible_connection=ssh
ansible_timeout=10
ansible_user=admin

[FIRST_SERVER]

运行uipathctl.sh脚本的起点。 这也称为 Ansible 主机节点。

您必须提供此节点的专用 IP 地址。

[SECONDARY_SERVER]

集群中其他服务器节点的组。

您必须提供所有其他服务器节点的专用 IP 地址。

[AGENTS]

集群中的代理节点组。

您必须提供所有代理节点的私有 IP 地址。

[TASKMINING]

集群中 Task Mining 节点的组。

您必须提供所有 Task Mining 节点的私有 IP 地址。

[GPU]

集群中 GPU 节点的组。

您必须提供所有 GPU 节点的私有 IP 地址。

[all:vars]

应用于所有先前定义的主机组的变量组。

  • ansible_connection - 身份验证方法。 支持两种 SSH 机制:基于密钥的 SSH 身份验证和基于密码的 SSH 身份验证。
  • ansible_timeout - 在操作超时之前可以建立 SSH 连接的默认时间。 它还控制建立连接后访问连接所需的时间。
  • ansible_user - 登录到远程服务器的用户的名称。

您可以按组或主机节点提供变量。有关详细信息,请参阅将变量分配给多台计算机:组变量

生成 Ansible 变量文件

对于其他节点上的 Ansible 业务流程,您必须定义一些参数,Ansible 使用这些参数来确定其他节点上安装程序和相应文件的位置。 这些参数在Yaml文件中定义,并提供给 Ansible。
如果要修改默认配置,请按以下格式创建文件,并使用--ansible-variables-file将其提供给uipathctl.sh }。
#Path where installer zip is available. By default, uipathctl.sh takes the current folder and compress it to zip before copying it to other nodes.
installer_path: /path/to/installer.zip
# Path where installer will be copied on nodes
target_installer_base_path: /opt/UiPathAutomationSuite/<version>/installer
# Install type - online or offline
install_type: online
# Path on nodes where offline bundles will be copied
target_bundle_base_path: /opt/UiPathAutomationSuite/{version}
# Path on nodes where offline bundles will be extracted
target_tmp_path: /opt/UiPathAutomationSuite/tmp
# Basepath and filname for the various config files and bundles on the local machine
cluster_config_filename: cluster_config.json
cluster_config_basepath: /var/tmp/uipathctl_{version}
backup_config_filename: backup_config.json
backup_config_basepath: /var/tmp/uipathctl_{version}
restore_config_filename: restore.json
restore_config_basepath: /var/tmp/uipathctl_{version}
infra_bundle_filename: sf-infra.tar.gz
infra_bundle_basepath: /var/tmp/uipath_upgrade_<version>#Path where installer zip is available. By default, uipathctl.sh takes the current folder and compress it to zip before copying it to other nodes.
installer_path: /path/to/installer.zip
# Path where installer will be copied on nodes
target_installer_base_path: /opt/UiPathAutomationSuite/<version>/installer
# Install type - online or offline
install_type: online
# Path on nodes where offline bundles will be copied
target_bundle_base_path: /opt/UiPathAutomationSuite/{version}
# Path on nodes where offline bundles will be extracted
target_tmp_path: /opt/UiPathAutomationSuite/tmp
# Basepath and filname for the various config files and bundles on the local machine
cluster_config_filename: cluster_config.json
cluster_config_basepath: /var/tmp/uipathctl_{version}
backup_config_filename: backup_config.json
backup_config_basepath: /var/tmp/uipathctl_{version}
restore_config_filename: restore.json
restore_config_basepath: /var/tmp/uipathctl_{version}
infra_bundle_filename: sf-infra.tar.gz
infra_bundle_basepath: /var/tmp/uipath_upgrade_<version>

变量

installer_path

sf-installer.zip的路径。 如果不提供此值, uipathctl.sh将压缩当前目录并将其作为安装程序 zip 复制到其他节点。

target_installer_base_path

安装程序将在节点上复制到的路径。 默认值为“/opt/UiPathAutomationSuite/{version

install_type

安装方法。 可能的值为: onlineoffline

target_bundle_base_path

将在其中复制离线捆绑包的节点上的路径。 默认位置为/var/tmp/uipathctl_{version}

target_tmp_path

提取捆绑包的节点上的路径。 默认位置为/opt/UiPathAutomationSuite/tmp

cluster_config_filename

集群配置文件的名称。 默认值为cluster_config.json

cluster_config_basepath

在编排期间, cluster_config.json将临时存储在节点上的位置。 默认值为/var/tmp/uipathctl_{version}

backup_config_filename

备份配置文件的名称。 默认值为backup.json

backup_config_basepath

在编排期间, backup.json将临时存储在节点上的位置。 默认值为/var/tmp/uipathctl_{version}

restore_config_filename

还原配置文件的名称。 默认值为restore.json

restore_config_basepath

在编排期间, restore.json 将临时存储在节点上的位置。 默认值为 `/var/tmp/uipathctl_{version

infra_bundle_filename

包含基础架构层的捆绑包的名称。 这与您提供给uipathctl.sh脚本的内容相同。

infra_bundle_basepath

在编排期间, sf-infra.tar.gz将临时存储在节点上的位置。 这与您提供给uipathctl.sh脚本的内容相同。

此页面是否有帮助?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath 白色徽标
信任与安全
© 2005-2024 UiPath. All rights reserved.