代码之家  ›  专栏  ›  技术社区  ›  Xaree Lee

如何使用ansible playbook和自制软件记录安装消息

  •  0
  • Xaree Lee  · 技术社区  · 6 年前

    我编写了一个ansible角色,任务如下:使用自制(.yaml)安装应用程序:

    - name: Install libraries with Homebrew
      homebrew:
        name:
          - zsh
          - vim
          - python
          - ...others
    

    它工作正常,但控制台没有打印每个库的安装结果。它只显示整个任务的结果:

    TASK [osx : Install libraries with Homebrew] *****************
    ok: [localhost]
    

    但我希望它打印出所有模块名称及其状态,如下所示:

    TASK [osx : Install libraries with Homebrew] *****************
    ok: [localhost] => (name=zsh)
    changed: [localhost] => (name=vim)
    ok: [localhost] => (name=python)
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   mdaniel    6 年前

    据我所知, the module 实际上,几乎每次调用stdout和stderr时都会吃它。它偶尔会返回stderr,但我没有看到它何时返回stdout

    既然是 community supported ,我所知道的最好的办法就是 file an issue 找零钱。

    解决问题的方法是只使用 - command: /usr/local/bin/brew install {{item}} 哪一个 stdout stderr ,坏消息是您必须手动管理幂等性:-(