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

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

问题描述

我正在使用带有 ansible playbook 的 vagrant 来自动在 ubuntu 映像上安装一堆程序.一个程序无法在 vagrant 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天全站免登陆