简体   繁体   English

Ansible 多行提示字符串 ios_command 模块

[英]Ansible Multiline prompt string ios_command module

I'm trying to reload a device with ansible ios_command.我正在尝试使用 ansible ios_command 重新加载设备。

The manual reload output is :手动重新加载输出为:

router#reload路由器#重新加载

Reload command is being issued on Active unit, this will reload the whole stack正在活动单元上发出重新加载命令,这将重新加载整个堆栈

Proceed with reload?继续重新加载? [confirm] [确认]

My reload playbook section looks like :我的重新加载剧本部分看起来像:

commands:
  -command: reload
    prompt: 'Proceed with reload? [confirm]'
    answer: "\r"

But I can not get it working.但我无法让它工作。 How can I specify several lines for prompt parsing?如何指定多行进行提示解析?

You can use with_items , this worked for me.您可以使用with_items ,这对我with_items

name: Confirmation Required
    pause:
      prompt: "{{ item }}"
    with_items: |
      proceed with reload ?
      Press ENTER to continue or CTRL+C and A to abort...

Based on akhil01 answer, this worked for me基于 akhil01 答案,这对我有用

name: Confirmation Required
    pause:
      prompt: |
        proceed with reload ?

        {{ vars_also_works }}

        Press ENTER to continue or CTRL+C and A to abort...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM