Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify style of 'wait_for' action syntax across playbooks #527

Merged
merged 1 commit into from
Mar 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
38 changes: 21 additions & 17 deletions ansible/boot_onie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,41 @@

- name: Wait for switch to come back (to ONIE)
local_action:
wait_for host={{ real_ansible_host }}
port=22
state=started
delay=60
timeout=300
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: started
delay: 60
timeout: 300
become: false
changed_when: false

- name: Wait for switch to reboot again
local_action:
wait_for host={{ real_ansible_host }}
port=22
state=stopped
delay=5
timeout=600
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: stopped
delay: 5
timeout: 600
become: false
changed_when: false

- name: Wait for switch to come back (to SONiC)
local_action:
wait_for host={{ real_ansible_host }}
port=22
state=started
delay=30
timeout=600
search_regex=OpenSSH
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: started
search_regex: "OpenSSH"
delay: 30
timeout: 600
become: false
changed_when: false

- name: Wait for the SONiC initialization process
pause: seconds=60
pause:
seconds: 60

- name: Set all bgp interfaces admin-up
become: true
Expand Down
8 changes: 7 additions & 1 deletion ansible/roles/sonic-common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,13 @@
tags: unsafe

- name: After rebooting, wait for switch to come back
local_action: wait_for host={{ inventory_hostname }} port=22 state=started delay=30 timeout=300
local_action:
wait_for:
host: "{{ inventory_hostname }}"
port: 22
state: started
delay: 30
timeout: 300
become: false
when: reboot_required is defined
tags: unsafe
13 changes: 7 additions & 6 deletions ansible/roles/test/tasks/common_tasks/reboot_sonic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@

- name: Wait for switch to come back
local_action:
wait_for host={{ ansible_host }}
port=22
state=started
delay=10
timeout=180
search_regex="OpenSSH_[\w\.]+ Debian"
wait_for:
host: "{{ ansible_host }}"
port: 22
state: started
search_regex: "OpenSSH_[\w\.]+ Debian"
delay: 10
timeout: 180
become: false
changed_when: false

Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/test/tasks/saiserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
when: no_deploy_saiserver is not defined

- name: Wait to make sure saiserver is started
wait_for: timeout=20
wait_for:
timeout: 20

- name: Run SAI Test
shell: ptf --test-dir /usr/share/ptf-tests {{ tests | default ("")}} -t "server='{{ ansible_host }}';port_map_file='/etc/ptf/default_interface_to_front_map.ini'" --platform remote {{ extra_options | default("")}} 2>&1
Expand Down
26 changes: 13 additions & 13 deletions ansible/roles/test/tasks/service_acl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
# Note that the timeout here should be sufficiently long enough to allow
# config_service_acls.sh to apply the new service ACLs
- name: Ensure the SSH port on the DuT becomes closed to us
wait_for:
port: 22
state: stopped
host: "{{ ansible_host }}"
timeout: 15
connection: local
local_action:
wait_for:
host: "{{ ansible_host }}"
port: 22
state: stopped
timeout: 15

# Gather facts with SNMP version 2
- name: Ensure attempt to gather basic SNMP facts about the device now times out
Expand All @@ -51,13 +51,13 @@
# Note that the timeout here should be sufficiently long enough to allow
# config_service_acls.sh to reset the ACLs to their original configuration
- name: Wait until the original service ACLs are reinstated and the SSH port on the DUT is open to us once again
wait_for:
port: 22
state: started
host: "{{ ansible_host }}"
search_regex: "OpenSSH"
timeout: 60
connection: local
local_action:
wait_for:
host: "{{ ansible_host }}"
port: 22
state: started
search_regex: "OpenSSH"
timeout: 60

- name: Delete config_service_acls.sh from the DuT
become: true
Expand Down
3 changes: 2 additions & 1 deletion ansible/roles/test/tasks/syslog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
service: name=rsyslog state=started

- name: Wait a little bit for service to start
wait_for: timeout=2
wait_for:
timeout: 2

# SSH to device and generate a syslog
- name: Send test syslog
Expand Down
35 changes: 19 additions & 16 deletions ansible/upgrade_sonic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@

- name: Wait for switch to come back (to ONIE)
local_action:
wait_for host={{ real_ansible_host }}
port=22
state=started
delay=60
timeout=300
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: started
delay: 60
timeout: 300
changed_when: false

- name: Stop onie discovery
Expand All @@ -55,11 +56,12 @@

- name: Wait for switch to reboot again (ONIE installation finishes)
local_action:
wait_for host={{ real_ansible_host }}
port=22
state=stopped
delay=5
timeout=600
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: stopped
delay: 5
timeout: 600
changed_when: false

when: upgrade_type == "onie"
Expand All @@ -85,12 +87,13 @@

- name: Wait for switch {{ inventory_hostname }} to come back (to SONiC)
local_action:
wait_for host={{ ansible_host }}
port=22
state=started
delay=30
timeout=600
search_regex=OpenSSH
wait_for:
host: "{{ real_ansible_host }}"
port: 22
state: started
search_regex: "OpenSSH"
delay: 30
timeout: 600
changed_when: false

- name: Wait for SONiC initialization
Expand Down