forked from colin-mccarthy/ansible-playbooks-for-cisco-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_combo2.yml
106 lines (90 loc) · 2.19 KB
/
config_combo2.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#Cisco IOS 12.2 Hardening Playbook
#
#+ no service pad
#+ ip ssh version 2
#+ no ip domain-lookup
#+ no ip http server
#+ no ip http secure-server
#+ no cdp run
#+ transport input ssh
#+ logging buffered 15000
#+ service password-encryption
- hosts: ios
gather_facts: no
connection: local
tasks:
- name: OBTAIN LOGIN CREDENTIALS
include_vars: secrets.yaml
- name: DEFINE PROVIDER
set_fact:
provider:
host: "{{ inventory_hostname }}"
username: "{{ creds['username'] }}"
password: "{{ creds['password'] }}"
auth_pass: "{{ creds['auth_pass'] }}"
- name: SHOW RUN | BEG VTY
ios_command:
provider: "{{ provider }}"
authorize: yes
commands:
- show run | beg vty
register: before_vty
- debug: var=before_vty.stdout_lines
- name: NO SERVICE PAD
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no service pad
- name: IP SSH VERSION 2
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- ip ssh version 2
- name: NO IP DOMAIN-LOOKUP
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no ip domain-lookup
- name: DISABLE HTTP/HTTPS MANAGMENT
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no ip http server
- no ip http secure-server
- name: DISABLE CDP
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- no cdp run
- name: TRANSPORT INPUT SSH
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- line vty 0 15
- transport input ssh
- name: LOGGING BUFFERED 15000
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- logging buffered 15000
- name: SERVICE PASSWORD ENCRYPTION
ios_config:
provider: "{{ provider }}"
authorize: yes
lines:
- service password-encryption
- name: SHOW RUN | BEG VTY
ios_command:
provider: "{{ provider }}"
authorize: yes
commands:
- show run | beg vty
register: after_vty
- debug: var=after_vty.stdout_lines