2017-03-18 25 views
6

içinde afiş mesajı görüntüleme Bir oynatma kitabının çalıştırılmasının ardından, sonraki adımlara ilişkin talimatlar vererek Ansible uygulamasında bir banner mesajı görüntülemek istiyorum. Bu i yaptık budur:Ansible

TASK [display post install message] ******************************************** 
ok: [localhost] => { 
    "msg": "Things left to do:\n- enable dash to dock gnome plugin in gnome tweal tool\n- install SpaceVim plugins: vim \"+call dein#install()\" +qa\n- git clone the dotfiles repo\n" 
} 

PLAY RECAP ********************************************************************* 
localhost     : ok=2 changed=0 unreachable=0 failed=0 

sonrası çalışma mesajı görüntülemek için bir yol var daha iyi mi:

- name: display post install message 
    debug: 
    msg: | 
     Things left to do: 
     - enable dash to dock gnome plugin in gnome tweal tool 
     - install SpaceVim plugins: vim "+call dein#install()" +qa 
     - git clone the dotfiles repo 

Ama bu böyle çirkin bir çıkış verir?

cevap

7

Oyun kitaplarında buna benzer bir şey yapıyorum. Nasıl biraz bunu böyle yeniden hakkında:

vars: 
    post_install: | 
     Things left to do: 
     - enable dash to dock gnome plugin in gnome tweal tool 
     - install SpaceVim plugins: vim "+call dein#install()" +qa 
     - git clone the dotfiles repo 

    tasks: 
    - name: display post install message 
    debug: msg={{ post_install.split('\n') } 

Çıktı

TASK [display post install message] ******************************************** 
ok: [localhost] => { 
    "msg": [ 
     "Things left to do:", 
     " - enable dash to dock gnome plugin in gnome tweal tool", 
     " - install SpaceVim plugins: vim \"+call dein#install()\" +qa", 
     " - git clone the dotfiles repo", 
     "" 
    ] 
} 

Diğer bir seçenek liste halinde afiş geçmektir:

- name: display post install message 
    debug: 
     msg: 
     - 'Things left to do:' 
     - '- enable dash to dock gnome plugin in gnome tweal tool' 
     - '- install SpaceVim plugins: vim "+call dein#install()" +qa' 
     - '- git clone the dotfiles repo' 

Çıktı

TASK [display post install message] ******************************************** 
ok: [localhost] => { 
    "msg": [ 
     "Things left to do:", 
     "- enable dash to dock gnome plugin in gnome tweal tool", 
     "- install SpaceVim plugins: vim \"+call dein#install()\" +qa", 
     "- git clone the dotfiles repo" 
    ] 
} 
+0

Teşekkürler, liste seçeneğini beğeniyorum. – GMaster

+0

Oyun sayfamda "post_install" ifadesini eklediğimde, oyun kitabımın çalıştırılmasından sonra mesaj gösterilmiyor "rollerim/myrole/vars/main.yaml" başlıklı rollerimi geliştirdim. Rolls/myrole/tasks/main.yaml' içinde 'vars' ile aynı bloğu koyduğumda hata veriyor. Bu 'post_install' bloğunu nereye eklemek zorundayım? Google yapmaya çalıştım ama şansım yok. – Nilesh