-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpb.jsnapy.snap.snap.check.yml
54 lines (47 loc) · 1.56 KB
/
pb.jsnapy.snap.snap.check.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
- name: jsnapy
hosts: AMS-EX4300
connection: local
gather_facts: no
roles:
- Juniper.junos
tasks:
- name: Collect Pre Snapshot
junos_jsnapy:
host: "{{ junos_host }}"
user: "{{ credentials.username }}"
passwd: "{{ credentials.password }}"
action: "snap_pre"
test_files: /etc/jsnapy/testfiles/test_file_check_lldp_states.yml
- name: Collect Post Snapshot
junos_jsnapy:
host: "{{ junos_host }}"
user: "{{ credentials.username }}"
passwd: "{{ credentials.password }}"
action: "snap_post"
test_files: /etc/jsnapy/testfiles/test_file_check_lldp_states.yml
- name: Compare snapshots
junos_jsnapy:
host: "{{ junos_host }}"
user: "{{ credentials.username }}"
passwd: "{{ credentials.password }}"
action: "check"
test_files: /etc/jsnapy/testfiles/test_file_check_lldp_states.yml
register: test_check
- name: Debug jsnapy
debug:
msg: "{{ test_check }}"
- name: Send Slack notification when jsnapy fails
local_action:
module: slack
username: "Ansible on {{ inventory_hostname }}"
channel: general
token: T2MBN64JX/B2N0Z2MEU/1OoB46XLX6Q1oFf89Xl2X9gq
icon_url: "https://www.ansible.com/hs-fs/hub/330046/file-448313641-png/favicon.png"
msg: "jsnapy test failed"
when: test_check.passPercentage != 100
- name: Check JSNAPy tests results
assert:
that:
- "test_check.passPercentage == 100"
msg: "jsnapy test on {{ inventory_hostname }} failed"