Ansible 在 ubuntu 16 上安装 RethinkDB

Ansible install RethinkDB on ubuntu 16

我正在尝试在 ubuntu 16.04 上使用 ansible package to install a specific version of RethinkDB

我使用:

- name: Ensure rethinkDB package repository is present
  apt_repository: repo='deb http://download.rethinkdb.com/apt xenial main' state=present
  tags:
    - rethinkdb

- name: install RethinkDB
  package: name=rethinkdb-2.3.2 state=latest
  tags:
    - rethinkdb

但是我收到以下错误:

TASK [install RethinkDB] ******************************************************* task path: /Users/nha/.../playbook.yml:173 fatal: [machine]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'rethinkdb-2.3.2' is available"} to retry, use: --limit @ops/ansible/playbook.retry

即使省略版本,我也会收到错误消息:

TASK [install RethinkDB] ******************************************************* task path: /Users/nha/.../playbook.yml:173 fatal: [machine]: FAILED! => {"cache_update_time": 0, "cache_updated": false, "changed": false, "failed": true, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'rethinkdb'' failed: E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n", "stderr": "E: There were unauthenticated packages and -y was used without --allow-unauthenticated\n", "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nThe following additional packages will be installed:\n libcurl3\nThe following NEW packages will be installed:\n libcurl3 rethinkdb\n0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.\nNeed to get 11.2 MB of archives.\nAfter this operation, 40.2 MB of additional disk space will be used.\nWARNING: The following packages cannot be authenticated!\n rethinkdb\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information...", "The following additional packages will be installed:", " libcurl3", "The following NEW packages will be installed:", " libcurl3 rethinkdb", "0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.", "Need to get 11.2 MB of archives.", "After this operation, 40.2 MB of additional disk space will be used.", "WARNING: The following packages cannot be authenticated!", " rethinkdb"]} to retry, use: --limit @ops/ansible/playbook.retry

第一条错误消息指出 RethinkDB apt 存储库不包含 2.3.2 版本的包。

第二个错误是因为您还没有添加 apt key to trust this repo. RethinkDB's Ubuntu installation instructions 还提到您需要添加他们的 apt 密钥。

您可以使用 apt_key 模块轻松完成此操作:

- name: add rethinkdb apt key
  apt_key: url=https://download.rethinkdb.com/apt/pubkey.gpg 

顺便说一句,指定版本然后在状态上指定 latest 并没有多大意义。