Juanma López
Juanma López

Reputation: 29

Ansible Multiline prompt string ios_command module

I'm trying to reload a device with 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?

Upvotes: 1

Views: 2653

Answers (2)

Axi
Axi

Reputation: 1805

Based on akhil01 answer, this worked for me

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

        {{ vars_also_works }}

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

Upvotes: 2

akhil01
akhil01

Reputation: 11

You can use with_items, this worked for me.

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

Upvotes: 1

Related Questions