【发布时间】:2015-06-10 15:16:27
【问题描述】:
我使用 ansible 脚本在 Amazon EC2 和一个 vagrant box 中设置我的环境 (Ubuntu)。然后我尝试在 GermanVPS (Ubuntu Minimal) 上设置相同的环境。使用 Apt 安装软件包似乎不起作用。
我跑
ansible-playbook -i ansible/live -u priidu ansible/caselaw.yml -s -vvvv --start-at-task="install"
这给出了以下错误。
failed: [master] => (item=postgresql-9.4,postgresql-contrib-9.4,postgresql-server-dev-9.4,python-psycopg2) => {"failed": true, "item": "postgresql-9.4,postgresql-contrib-9.4,postgresql-server-dev-9.4,python-psycopg2"}
stderr: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'postgresql-server-dev-9.4' 'python-psycopg2'' failed: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
FATAL: all hosts have already failed -- aborting
那我试试
ansible-playbook -i ansible/live -u priidu ansible/caselaw.yml -s -vvvv --start-at-task="dpkg configure"
我收到以下错误消息
failed: [master] => (item=postgresql-9.4,postgresql-contrib-9.4,postgresql-server-dev-9.4,python-psycopg2) => {"failed": true, "item": "postgresql-9.4,postgresql-contrib-9.4,postgresql-server-dev-9.4,python-psycopg2", "parsed": false}
BECOME-SUCCESS-grensagvuewehoylwpjytnkzpwwqgsre
Killed
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/priidukull/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 51: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 54431
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 0
Shared connection to <<hostname>> closed.
FATAL: all hosts have already failed -- aborting
那里发生了什么,我该如何开始解决这个难题?
编辑:我的剧本的相关部分
- name: dpkg configure
shell: dpkg --configure -a
- name: install
apt: name={{ item }} update_cache=yes
with_items:
- postgresql-9.4
- postgresql-contrib-9.4
- postgresql-server-dev-9.4
- python-psycopg2
编辑 2:添加了剧本命令。
编辑 3:当我将 RAM 从 64MB 增加到 512MB 时,问题消失了。
【问题讨论】:
-
粘贴剧本的相关部分
-
你用 sudo 运行剧本吗?从您的 sn-p 中不清楚,但可能是原因。
-
-s 代表“sudo” 无论如何,我刚刚注意到我购买了一个虚拟服务器,其 RAM 很小,只有 64MB。所以我将远离那个硬件。