-
Notifications
You must be signed in to change notification settings - Fork 2
/
shutport.yml
45 lines (34 loc) · 853 Bytes
/
shutport.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
---
#Playbook to shut and no shut a port from provided inputs
- hosts: localhost
gather_facts: false
vars_prompt:
- name: "switch"
prompt: "Enter the Switch Name"
private: no
tasks:
- add_host:
name: "{{ switch }}"
groups: switch_to_configure
- hosts: switch_to_configure
gather_facts: false
vars_prompt:
- name: "interface"
prompt: "Enter the Interface Name"
private: no
tasks:
- name: Shut the Port
ios_config:
lines:
- shutdown
parents: interface {{ interface }}
- debug:
msg: "Interface {{ interface }} is shut - Pause for 3 seconds }}"
- pause: seconds=5
- name: UnShut the Port
ios_config:
lines:
- no shutdown
parents: interface {{ interface }}
- debug:
msg: "Interface {{ interface }} has been bounced"