我必须在一个旧项目中进行编码。它使用 vagrant 盒子,如果我做 vagrant up 和 vagrant provision 我得到这个错误:
TASK [Add MariaDB apt key] *****************************************************
fatal: [default]: FAILED! => {"changed": false, "cmd": "/usr/bin/apt-key adv --no-tty --keyserver p80.pool.sks-keyservers.net:80 --recv F1656F24C74CD1D8", "msg": "Error fetching key F1656F24C74CD1D8 from keyserver: p80.pool.sks-keyservers.net:80", "rc": 2, "stderr": "gpg: requesting key C74CD1D8 from p80.pool.sks-keyservers.net:80\ngpg: keyserver internal error\ngpg: keyserver receive failed: keyserver error\n", "stderr_lines": ["gpg: requesting key C74CD1D8 from p80.pool.sks-keyservers.net:80", "gpg: keyserver internal error", "gpg: keyserver receive failed: keyserver error"], "stdout": "Executing: /tmp/tmp.arnDbK2ymL/gpg.1.sh --no-tty\n--keyserver\np80.pool.sks-keyservers.net:80\n--recv\nF1656F24C74CD1D8\ngpgkeys: no keyserver host provided\n", "stdout_lines": ["Executing: /tmp/tmp.arnDbK2ymL/gpg.1.sh --no-tty", "--keyserver", "p80.pool.sks-keyservers.net:80", "--recv", "F1656F24C74CD1D8", "gpgkeys: no keyserver host provided"]}
PLAY RECAP *********************************************************************
default : ok=18 changed=4 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
配置 yml 说:
- name: Add MariaDB apt key
apt_key:
keyserver: p80.pool.sks-keyservers.net:80
id: F1656F24C74CD1D8
- name: Add MariaDB repo to apt
apt_repository:
repo: "deb http://ftp.osuosl.org/pub/mariadb/repo/{{ mariadb_version }}/ubuntu xenial main"
state: present
- name: Install MariaDB
apt: package={{ item }} state=present force=yes update_cache=yes cache_valid_time=3600
when: ansible_os_family == 'Debian'
with_items:
- "mariadb-server-{{ mariadb_version }}"
- python-mysqldb
请帮忙 ;)