使用 Ansible 将 Quantum Mobile 部署到 AWS EC2 实例时遇到问题。我不确定如何配置名为 "vagrant" 或 "vagrant-ssh" 的设置

Having trouble using Ansible to deploy Quantum Mobile to AWS EC2 Instance. I'm not sure how to configure a setting called "vagrant" or "vagrant-ssh"

这里是shell中的反馈。我不确定如何配置或安装这个无所事事的东西。我在网上找不到任何明确的说明。任何帮助将不胜感激。

  (quantum_env) user@localComputer quantum-mobile % tox -e ansible -- --extra-vars "build_hosts_aws"



...
ansible run-test: commands[0] | ansible-playbook playbook-build.yml --extra-vars build_hosts_aws
[WARNING]: Invalid characters were found in group names but not replaced, use
-vvvv to see details

PLAY [Install ansible prerequisites] *******************************************

TASK [test configuration] ******************************************************
Sunday 14 February 2021  14:00:22 -0500 (0:00:00.040)       0:00:00.040 *******
ok: [vagrant-ssh] =>
  msg: RUNNING PLAYBOOK FOR 'Quantum Mobile' VERSION '20.11.2a'

TASK [testing ansible environment] *********************************************
Sunday 14 February 2021  14:00:22 -0500 (0:00:00.029)       0:00:00.070 *******
ok: [vagrant-ssh] =>
  msg: Connecting to host 'vagrant-ssh' as user 'vagrant'

TASK [Make local dist folder] **************************************************
Sunday 14 February 2021  14:00:22 -0500 (0:00:00.034)       0:00:00.105 *******
ok: [vagrant-ssh]

TASK [marvel-nccr.ansible_prerequisites : update cache] ************************
Sunday 14 February 2021  14:00:23 -0500 (0:00:00.369)       0:00:00.475 *******
fatal: [vagrant-ssh]: UNREACHABLE! => changed=false
  msg: 'Failed to connect to the host via ssh: Can''t open user config file vagrant-ssh: No such file or directory'
  unreachable: true

PLAY RECAP *********************************************************************
vagrant-ssh                : ok=3    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0

Sunday 14 February 2021  14:00:23 -0500 (0:00:00.026)       0:00:00.501 *******
===============================================================================
Make local dist folder -------------------------------------------------- 0.37s
testing ansible environment --------------------------------------------- 0.03s
test configuration ------------------------------------------------------ 0.03s
marvel-nccr.ansible_prerequisites : update cache ------------------------ 0.03s
ERROR: InvocationError for command /Users/user/quantum-mobile/.tox/ansible/bin/ansible-playbook playbook-build.yml --extra-vars build_hosts_aws (exited with code 4)
___________________________________ summary ____________________________________
ERROR:   ansible: commands failed

更新:我能够从 link 安装 Vagrant,但无法正确安装 VirtualBox。当我尝试执行 vagrant up 时,我收到以下错误消息

(quantum_env) localhost:quantum-手机用户$ vagrant up 正在将机器 'default' 与 'virtualbox' 供应商联系起来... ==> 默认:检查框 'bento/ubuntu-18.04' 版本 '202012.21.0' 是否是最新的... ==>默认:清除任何以前设置的网络接口... 执行 VBoxManage 时出错,Vagrant 使用的 CLI 用于控制 VirtualBox。命令和标准错误如下所示。

命令:["hostonlyif", "create"]

标准错误:0%... 进度状态:NS_ERROR_FAILURE VBoxManage:错误:无法创建仅主机适配器 VBoxManage:错误:VBoxNetAdpCtl:添加新界面时出错:无法打开/dev/vboxnetctl:没有这样的文件或目录 VBoxManage: 错误: 详细信息: 代码 NS_ERROR_FAILURE (0x80004005),组件 HostNetworkInterfaceWrap,接口 IHostNetworkInterface VBoxManage:错误:上下文:文件第 95 行的“RTEXITCODE handleCreate(HandlerArg *)”VBoxManageHostonly.cpp

来自文档

Prerequisites & Installation

Vagrant >= 2.0.1
VirtualBox >= 6.1.6
Python >= 3.6

你可以从这里安装 vagrant Installing Vagrant and VirtualBox from here

安装 vagrantVirtualBox 后,您可以通过

启动机器
vagrant up

ansible-playbooks 的主仓库中有一个 Vagrantfile

之后,您可以按照 documentation

中的描述简单地配置 vagrant-ssh
vagrant ssh-config > vagrant-ssh
tox -e ansible

根据您想要 运行 ansible-playbook 的方式,您需要修改 inventory

中的几个参数

您看到的错误源于 inventory

中的以下配置
vagrant-provision:
    # this private network IP will be created by `vagrant up`
    cloud_platform: virtualbox
    ansible_host: 192.168.111.222
    ansible_user: vagrant
vagrant-ssh:
    # requires first running `vagrant ssh-config > vagrant-ssh`
    cloud_platform: virtualbox
    ansible_host: default
    ansible_ssh_common_args: "-F vagrant-ssh"
    ansible_user: vagrant

如果您想使用 aws 机器,您需要在此处更新 IP 地址。

    # To connect to VMs you should change the host IP and provide an SSH key file
aws:
    cloud_platform: aws
    ansible_host: 34.227.10.49  # change this
    ansible_ssh_common_args: -i ./keys/quantum-mobile.pem -o StrictHostKeyChecking=no
    ansible_user: ubuntu
    vm_headless: true
    add_user_public_key: "{{ lookup('file', './keys/user-key.pub') }}

启动实例可以参考here

似乎启动实例的 link 坏了。

你可以按照这个来Launch an Amazon EC2 Instance