DC/OS Ansible 常见问题和故障排除

使用 DC/OS Ansible 时经常问的问题和常见问题

官方的 Ansible Galaxy 页面和版本 .

Ansible 新手

如果您是 Ansible 新手,则强烈建议您先了解入门指南。该指南更好地解释和介绍了我们如何使用 Ansible 来成功管理 DC/OS 生命周期。

设置 SSH

SSH 是指 Ansible 用来通过清单文件连接和管理主机的协议。如果您需要在 Ansible 控制机及其管理节点之间设置 SSH 连接,请参阅以下 .

然后,您可以通过以下方式测试连接:

如果仍出现 ssh 错误,请确保您正在以正确的 尝试进行连接。. 此项目的默认值为 centos,可能与您的情况不同。

如果您有不同的 ansible.cfg,则这也可能是 host_key_checking. 的问题。您可以将其设置为 False 然后重试,或确保将正确的密钥添加到 ssh 代理。您可以通过以下方式检查您的密钥是否已添加:

  1. ssh-add -l # for a list of keys
  2. ssh-add ~/your/key # to add to ssh agent

如果您的网络或节点繁时,可能会出现超时,例如:

如果您尝试多次并且继续发生错误而没有成功运行,您应该对此实例开始故障排除,以了解节点是否存在问题。

未提供清单文件

发出 Asible 命令时,会出现以下错误:

  1. [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
  2. [WARNING]: No inventory was parsed, only implicit localhost is available
  3. [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

确保您位于含有清单文件的目录中。有关清单文件的更多信息,请参阅 Ansible 文档.

remote_user 配置错误

如果您在连接到以下机器时遇到错误:

可能是您在尝试连接错误的 remote_user。请检查您的 ansible.cfg 或使用正确的远程用户运行命令。

  1. Failure generating config
  2. fatal: [172.16.2.65]: FAILED! => {"changed": true, "cmd": ["bash", "dcos_generate_config.ee.sh"], "delta": "0:00:02.724998", "end": "2019-04-08 17:50:51.568479", "msg": "non-zero return code", "rc": 1, "start": "2019-04-08 17:50:48.843481", "stderr": "\u001b[33m====> EXECUTING CONFIGURATION GENERATION\u001b[0m\nGenerating configuration files...\n\u001b[1;31mbouncer_expiration_auth_token_days: bouncer_expiration_auth_token_days must be a number of days or decimal thereof.\u001b[0m", "stderr_lines": ["\u001b[33m====> EXECUTING CONFIGURATION GENERATION\u001b[0m", "Generating configuration files...", "\u001b[1;31mbouncer_expiration_auth_token_days: bouncer_expiration_auth_token_days must be a number of days or decimal thereof.\u001b[0m"], "stdout": "", "stdout_lines": []}
  3. module.dcos.module.dcos-install.module.dcos-install.null_resource.run_ansible_from_bootstrap_node_to_install_dcos (remote-exec): to retry, use: --limit @/dcos_playbook.retry

上述错误实际上不是 Ansible 错误,但是 dcos 发出的错误会生成配置脚本。请确保您的 DC/OS 配置有正确的键值。请参阅 DC/OS 文档了解 .

确保您已为正在尝试安装的 DC/OS 的版本指定了正确的 URL。您可以通过以下方式找到可用链接:

Mazer 安装目录

不同版本的 Mazer 或定制 Mazer 安装都通过 Mazer 配置文件维护。在此配置文件中保持的其中一个配置是 content_path,这是从 Galaxy 提取内容的安装位置。如果您在找到内容路径或 Mazer 配置文件时遇到问题,请发出以下命令以找到 Mazer 配置文件:

在 Mazer 配置文件中,检查 . 您可以在此查看有关 Mazer 配置文件的更多信息以及更多选项。

更换 bootstrap 节点后 DC/OS 安装或升级失败

如果您需要更换群集中的 bootstrap 节点实例,则需要更新要反映的新清单文件以及变量文件中的 bootstrap_url 如果您在更换 bootstrap 节点后收到以下错误,请确保您也更新了变量文件。

  1. TASK [DCOS.master : Upgrade: Run DC/OS master upgrade] **********************************************************************
  2. fatal: [172.12.8.139]: FAILED! => {"changed": true, "cmd": "set -o pipefail; ./dcos_node_upgrade.sh --verbose | systemd-cat -t dcos-upgrade", "delta": "0:00:27.758455", "end": "2019-04-06 00:59:47.232139", "msg": "non-zero return code", "rc": 1, "start": "2019-04-06 00:59:19.473684", "stderr": "ERROR: Unable to fetch package dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0: Problem fetching http://172.12.6.132:8080/1.12.0/genconf/serve/packages/dcos-config/dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0.tar.xz to /tmp/tmp09jvhnfa.tar.xz because of HTTPConnectionPool(host='172.12.6.132', port=8080): Max retries exceeded with url: /1.12.0/genconf/serve/packages/dcos-config/dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0.tar.xz (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7272a92a90>: Failed to establish a new connection: [Errno 113] No route to host',)). Unable to remove partial download. Future builds may have problems because of it.", "stderr_lines": ["ERROR: Unable to fetch package dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0: Problem fetching http://172.12.6.132:8080/1.12.0/genconf/serve/packages/dcos-config/dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0.tar.xz to /tmp/tmp09jvhnfa.tar.xz because of HTTPConnectionPool(host='172.12.6.132', port=8080): Max retries exceeded with url: /1.12.0/genconf/serve/packages/dcos-config/dcos-config--setup_c0495a51346db67a274d71c612d1f0648ead23d0.tar.xz (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f7272a92a90>: Failed to establish a new connection: [Errno 113] No route to host',)). Unable to remove partial download. Future builds may have problems because of it."], "stdout": "", "stdout_lines": []}
  3. to retry, use: --limit @/home/centos/ansible_collections/dcos/dcos_ansible/dcos-ansible-0.51.0/dcos.retry

升级 DC/OS 版本或 DC/OS 配置更改是我们支持的两种群集升级方案。我们使这变得非常简单,只需要很少的更改。我们的 dcos-ansible 工具能够确定您尝试执行的升级方案类型。

  • 如果您尝试将 DC/OS 版本升级为新版本,只需将 download(可变文件)中的 versiondcos.yml 变量改为您所需的版本。然后,只需重新 playbook 便可让更改生效。