forked from ksator/openconfig-demo-with-juniper-devices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pb.check.interfaces.yml
30 lines (27 loc) · 1.01 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
---
- name: Check if interfaces are up
hosts: Openconfig_Routers
connection: local
gather_facts: no
tasks:
- name: Check if Physical Interfaces are up
junos_command:
commands:
- "show interfaces terse {{ item.interface }}"
provider: "{{ credentials }}"
display: 'xml'
waitfor:
- "result[0]['rpc-reply']['interface-information']['physical-interface']['oper-status'] eq up"
with_items:
- "{{ topology }}"
when: ansible_version['major'] == 2 and ansible_version['minor']|int >= 4
- name: Send Slack notification to the team
local_action:
module: slack
#http://docs.ansible.com/ansible/slack_module.html
username: "Ansible on {{ inventory_hostname }}"
channel: openconfig
token: T2MBN64JX/B2N0Z2MEU/1OoB46XLX6Q1oFf89Xl2X9gq
icon_url: "https://www.ansible.com/hs-fs/hub/330046/file-448313641-png/favicon.png"
msg: "check completed using pb.check.interfaces.yml"
validate_certs: false