ansible - cisco IOS and “reload” command

前端 未结 5 585
梦如初夏
梦如初夏 2021-01-27 02:37

I would like to send command \"reload in \" to Cisco IOS, but that specific command needs to be confirmed like below:

#reload in 30
Reload scheduled in 30 minut         


        
5条回答
  •  忘掉有多难
    2021-01-27 02:49

    Ansible 2.2 only

    You could use something like this:

      - name: send reload command inc confirmation
        ios_command:
          commands: 
            - reload in 30
            - y
          wait_for: 
            - result[0] contains "Proceed with reload" 
          provider: "{{ cli }}"
    

    Not tested but similar to last example for ios_command module.

    Take care with Ansible 2.2 though, it's not released yet and new releases of Ansible can have significant regressions.

    Ansible 2.0+ includes the expect module but that requires Python on the remote device, so it won't work on IOS or similar devices.

提交回复
热议问题