-
Notifications
You must be signed in to change notification settings - Fork 1
/
pb.deploy.maintenance.yml
65 lines (55 loc) · 1.78 KB
/
pb.deploy.maintenance.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
55
56
57
58
59
60
61
62
63
64
65
# Copyright 2018, Juniper Networks Pvt Ltd.
# All rights reserved.
# This creates a BGP Spine/Leaf configuration, deploys it, and tests for availability.
# command example: ansible-playbook pb.deploy.maintenance.yml --extra-vars "spine=QFX5110-32Q-169"
# Successfully ran on ansible version: ansible 2.4.2.0: ansible-galaxy list Juniper.junos,1.4.3
---
- name: create configuration_backup directories
hosts: localhost
gather_facts: no
tasks:
- name: create configuration directory
file:
path: "{{playbook_dir}}/render"
state: directory
- name: create configuration subdirectories
file:
path: "{{playbook_dir}}/render/{{ item }}"
state: directory
with_items:
- maintenance_render
- name: configure devices
hosts: "{{ spine }}"
connection: local
gather_facts: no
tags:
- configuration
tasks:
- name: Render BGP configuration for junos devices
template:
src: "{{playbook_dir}}/templates/replacepolicy.j2"
dest: "{{playbook_dir}}/render/maintenance_render/{{ junos_host }}.conf"
- name: push bgp configuration on devices if ansible version is >= 2.4
junos_config:
provider: "{{ credentials }}"
src: "{{playbook_dir}}/render/maintenance_render/{{ junos_host }}.conf"
update: merge
src_format: text
backup: yes
comment: enforce desired bgp config from ansible
when: (ansible_version['major'] == 2 and ansible_version['minor']|int >= 4)
- name: wait for op states to converge
hosts: localhost
gather_facts: no
tasks:
- pause: seconds=30
- name: check op states
hosts: junos-ssh
connection: local
gather_facts: no
tags:
- audit
roles:
- Juniper.junos
- include: pb.collect.facts.yml
- include: pb.check.bgp.underlay.yml