Ansible apt-get安装输出 [英] Ansible apt-get install output

查看:337
本文介绍了Ansible apt-get安装输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将无业游民与ansible剧本一起使用,以在ubuntu映像上自动安装一堆程序.一个程序无法在无业游民的VM上安装.在Vagrant文件中

I am using vagrant with an ansible playbook to automatically install a bunch of programs on an ubuntu image. One program is failing to install on the vagrant VM. In the Vagrant file I have

config.vm.provision :ansible do |ansible|
  ansible.verbose = "vvv"
  ansible.playbook = "provisioning/playbook.yml"
end

,但详细输出不包含apt-get输出.我的playbook.yml看起来像

but the verbose output does not include the apt-get output. My playbook.yml looks like

---
- hosts: all
  sudo: true
  tasks:
    - name: get vi
      apt: state=latest name=vim  

我如何查看VM上单个(或全部)apt-get install的控制台输出,因为ansible会以以下格式输出每个安装

How can I see the console output of an individual (or all) apt-get install's on the VM since ansible instead outputs each install in the format

TASK: [Install vim] *********************************************************** 
failed: [default] => {"failed": true}
...

推荐答案

您可以将apt模块执行的输出注册到变量中,然后将其打印出来.

You can register to a variable the output of the apt module execution and then print it.

- hosts: localhost
  sudo: true
  tasks:
    - name: get vi
      apt: state=latest name=vim
      register: aptout

    # show the content of aptout var
    - debug: var=aptout

这篇关于Ansible apt-get安装输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆