2015-05-12 50 views
0

我有以下ansible玩法:軌Ansible顯示輸出測試

- name: run rails tests 
    hosts: marflar 
    sudo: yes 
    sudo_user: vagrant 
    tags: 
    - rake 
    tasks: 
    - name: configure nokogiri 
     command: bash -lc "bundle config build.nokogiri --use-system-libraries" 

    - name: install gems 
     command: bash -lc "bundle install" 
     register: bundle_complete 

    - name: check if database exists 
     command: bash -lc "bundle exec rake db:version" 
     ignore_errors: True 
     register: rake_db_version_result 

    - name: create database 
     command: bash -lc "bundle exec rake db:setup" 
     register: db_setup_complete 
     when: rake_db_version_result|failed 

    - name: apply database migrations 
     command: bash -lc "bundle exec rake db:migrate" 
     register: db_setup_complete 
     when: rake_db_version_result|success 

    - name: running the test suite 
     command: bash -lc "bundle exec rake test" 
     when: db_setup_complete 

它運作良好,但我看不到的bundle exec rake test輸出,直到它完成之後。有沒有辦法顯示我的測試結果?

回答

2

它看起來像一個lot of people have requested this feature,但Ansible維護人員已決定這種功能is not a good fit for the way Ansible is built


編輯爲淨度:

有很多的原因,提供在ansible實時輸出,不支持,也有從售票數了堅實的論據:

Ansible包含235+個模塊和基本上全部使用的API 這些模塊沒有任何報告狀態的可能性 中間的異步操作

而且

並行對幾百臺主機

如果你真的想看到的命令,而其執行輸出運行時,CLI有沒有什麼好辦法來輸出標準輸出的變化,你可能更好的嘗試SSH或其他工具,Ansible不能這樣做。