Browse Source

Adding retries and delay to all junos commands

Change-Id: I20333e923a8bf742a2c56e0cf437463fbffb5884
Dan Radez 1 month ago
parent
commit
7ff8944888

+ 4
- 0
etc/ansible/roles/openstack-ml2/providers/junos/conf_trunk_port.yaml View File

@@ -8,4 +8,8 @@
8 8
       - "set interfaces {{ port_name }} native-vlan {{ _vlan_id }}"
9 9
       - "set interfaces {{ port_name }} unit 0 family ethernet-switching vlan members [{{ _vlan_id }}{% for vlan in trunked_vlans %} {{ vlan }}{% endfor %}]"
10 10
       - commit
11
+  register: result
12
+  retries: {{ _retries }}
13
+  delay: {{ _delay }}
14
+  until: result.msg is not defined or result.msg.find(junos_retries_msg) == -1
11 15
   connection: network_cli

+ 4
- 0
etc/ansible/roles/openstack-ml2/providers/junos/create_vlan.yaml View File

@@ -5,4 +5,8 @@
5 5
       - config
6 6
       - "set vlans {{ _vlan_name }} vlan-id {{ _vlan_id }}"
7 7
       - commit
8
+  register: result
9
+  retries: {{ _retries }}
10
+  delay: {{ _delay }}
11
+  until: result.msg is not defined or result.msg.find(junos_retries_msg) == -1
8 12
   connection: network_cli

+ 4
- 0
etc/ansible/roles/openstack-ml2/providers/junos/delete_port.yaml View File

@@ -5,4 +5,8 @@
5 5
       - config
6 6
       - "delete interfaces {{ port_name }}"
7 7
       - commit
8
+  register: result
9
+  retries: {{ _retries }}
10
+  delay: {{ _delay }}
11
+  until: result.msg is not defined or result.msg.find(junos_retries_msg) == -1
8 12
   connection: network_cli

+ 4
- 0
etc/ansible/roles/openstack-ml2/providers/junos/delete_vlan.yaml View File

@@ -5,4 +5,8 @@
5 5
       - config
6 6
       - "delete vlans {{ _vlan_name }}"
7 7
       - commit
8
+  register: result
9
+  retries: {{ _retries }}
10
+  delay: {{ _delay }}
11
+  until: result.msg is not defined or result.msg.find(junos_retries_msg) == -1
8 12
   connection: network_cli

+ 4
- 0
etc/ansible/roles/openstack-ml2/providers/junos/update_access_port.yaml View File

@@ -7,4 +7,8 @@
7 7
       - "set interfaces {{ port_name }} unit 0 family ethernet-switching interface-mode access"
8 8
       - "set interfaces {{ port_name }} unit 0 family ethernet-switching vlan members {{ _vlan_id }}"
9 9
       - commit
10
+  register: result
11
+  retries: {{ _retries }}
12
+  delay: {{ _delay }}
13
+  until: result.msg is not defined or result.msg.find(junos_retries_msg) == -1
10 14
   connection: network_cli

+ 7
- 0
etc/ansible/roles/openstack-ml2/vars/main.yml View File

@@ -1,4 +1,8 @@
1 1
 ---
2
+# Default retry and delay values
3
+_retries: 10
4
+_delay: 7
5
+
2 6
 # vars required for managing VLANs
3 7
 vlan_id: null
4 8
 vlan_name: null
@@ -9,3 +13,6 @@ vlans: null
9 13
 # vars required for managing ports
10 14
 port_name: null
11 15
 port_description: null
16
+
17
+# Vendor specific variables
18
+junos_retries_msg: 'configuration database locked by:'

Loading…
Cancel
Save