Skip to content

Instantly share code, notes, and snippets.

@IPvSean IPvSean/reboot.yml
Last active Jan 13, 2020

Embed
What would you like to do?
Reboot Ansible Playbook for an Arista vEOS machine
---
- name: reboot arista eos router
hosts: routers
gather_facts: false
tasks:
- name: reboot device
cli_command:
command: reload now
- name: reset the connection
meta: reset_connection
- name: wait for network device to come back up
wait_for_connection:
delay: 10
- name: grab the uptime
cli_command:
command: show ver | i Uptime
register: uptime
- name: show uptime
debug:
msg: "{{uptime.stdout}}"
[student1@ansible ~]$ ansible-playbook arista.yml
PLAY [reboot arista eos router] ***************************************************************************************************************************************************
TASK [reboot device] *************************************************************************************************************************************************************
ok: [rtr1]
ok: [rtr3]
ok: [rtr4]
ok: [rtr2]
TASK [wait for network device to come back up] *************************************************************************************************************************************
ok: [rtr2]
ok: [rtr1]
ok: [rtr4]
ok: [rtr3]
TASK [grab the uptime] ***********************************************************************************************************************************************************
ok: [rtr1]
ok: [rtr4]
ok: [rtr3]
ok: [rtr2]
TASK [show uptime] ***************************************************************************************************************************************************************
ok: [rtr2] =>
msg: 'Uptime: 0 weeks, 0 days, 0 hours and 2 minutes'
ok: [rtr3] =>
msg: 'Uptime: 0 weeks, 0 days, 0 hours and 2 minutes'
ok: [rtr4] =>
msg: 'Uptime: 0 weeks, 0 days, 0 hours and 2 minutes'
ok: [rtr1] =>
msg: 'Uptime: 0 weeks, 0 days, 0 hours and 2 minutes'
PLAY RECAP ***********************************************************************************************************************************************************************
rtr1 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr2 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr3 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
rtr4 : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.