forked from ksator/netbox_automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpb_check_interfaces.yml
37 lines (32 loc) · 1.05 KB
/
pb_check_interfaces.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: check interface states
hosts: qfx10002-36q
connection: local
gather_facts: no
tasks:
- name: check if interfaces admin status is up
junos_command:
provider: "{{ credentials }}"
display: 'xml'
commands:
- "show interfaces terse {{ item.interface }}"
waitfor:
- "result[0]['rpc-reply']['interface-information']['physical-interface']['admin-status'] eq up"
retries: 3
interval: 3
with_items:
- "{{ vars_from_netbox_api }}"
when: (ansible_version['major'] == 2 and ansible_version['minor']|int >= 4)
- name: check if interfaces op status is up
junos_command:
provider: "{{ credentials }}"
display: 'xml'
commands:
- "show interfaces terse {{ item.interface }}"
waitfor:
- "result[0]['rpc-reply']['interface-information']['physical-interface']['oper-status'] eq up"
retries: 3
interval: 3
with_items:
- "{{ vars_from_netbox_api }}"
when: (ansible_version['major'] == 2 and ansible_version['minor']|int >= 4)