Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ansible/roles/eos/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- name: Restart the box
command: /sbin/shutdown -r now "Ansible updates triggered"

- name: Pause for reboot
pause: seconds=30

- name: Wait for VM to come up
local_action: shell ansible -m ping -i veos {{ inventory_hostname }}
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local_action [](start = 2, length = 12)

Use 'ping' module? #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failure of ping module would cause playbook fail. Replaced the ping command with the ansible wait_for module which is designed for this kind of job.

register: wait_result
until: wait_result.rc == 0
retries: 30
delay: 30
4 changes: 3 additions & 1 deletion ansible/roles/eos/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
- name: build a startup config
template: src="{{ topo }}-{{ props.swrole }}.j2"
dest=/mnt/flash/startup-config
when: configuration is defined
when: hostname in configuration
notify:
- Restart the box
- Pause for reboot
- Wait for VM to come up
Copy link
Copy Markdown
Contributor

@qiluo-msft qiluo-msft May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is dangerous to assume the order of notify items. ref: https://stackoverflow.com/a/35130254/2514803

Suggest use normal tasks in this playbook. #Closed

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qiluo-msft
Thanks for the suggestion. Updated and committed. Replaced notifying handlers with tasks.