Added FQCN to current playbooks + minor changes

This commit is contained in:
Vlad R 2022-06-27 09:55:16 +00:00
parent 0cfa584471
commit f7ff158b0a
5 changed files with 58 additions and 38 deletions

View File

@ -1,5 +1,6 @@
--- ---
## This playbook collects the device facts and prints out key information ## This playbook collects the device facts and prints out key information. It supports only basice device features and does not supply full information
## for devices which feature VRFs or multi-instance capabilities.
- name: Audit devices and print key information - name: Audit devices and print key information
hosts: baguleykit hosts: baguleykit
@ -11,19 +12,16 @@
tasks: tasks:
- name: Collect device configuration - name: Collect device configuration
ios_facts: cisco.ios.ios_facts:
gather_subset: all gather_subset: all
register: current_config register: current_config
- debug:
msg: "ANSIBLE-{{ current_config.ansible_facts.ansible_net_model }}"
- name: Print device identity info - name: Print device identity info
debug: debug:
msg: "{{ current_config.ansible_facts.ansible_net_hostname }} is reachable and the OS is {{ current_config.ansible_facts.ansible_net_version }}. SN is {{ current_config.ansible_facts.ansible_net_serialnum }}. Model is {{current_config.ansible_facts.ansible_net_model }}" msg: "{{ current_config.ansible_facts.ansible_net_hostname }} is reachable and the OS is {{ current_config.ansible_facts.ansible_net_version }}. SN is {{ current_config.ansible_facts.ansible_net_serialnum }}. Model is {{current_config.ansible_facts.ansible_net_model }}"
- name: Collect interface, routing and device runtime information - name: Collect interface, routing and device runtime information
ios_command: cisco.ios.ios_command:
commands: commands:
- show ip interface brief - show ip interface brief
- show interface description - show interface description

View File

@ -13,13 +13,13 @@
#Collect current device information #Collect current device information
- name: Collect device facts - name: Collect current device facts
ios_facts: cisco.ios.ios_facts:
gather_subset: all gather_subset: all
register: current_config register: current_config
- name: Configuring login banner - name: Configuring login banner
ios_banner: cisco.ios.ios_banner:
banner: login banner: login
text: | text: |
|--------------------------------------------------------------------------| |--------------------------------------------------------------------------|
@ -33,17 +33,17 @@
state: present state: present
- name: Configuring exec banner - name: Configuring exec banner
ios_banner: cisco.ios.ios_banner:
banner: exec banner: exec
text: | text: |
|--------------------------------------------------------------------------| |--------------------------------------------------------------------------|
|This device is managed, supported and it's configuration owned by the | |This device is managed, supported and its configuration is owned by the |
|Virgin Media Business Near Core Activations team in England | |Virgin Media Business Near Core Activations team in England. |
|--------------------------------------------------------------------------| |--------------------------------------------------------------------------|
state: present state: present
- name: Configuring MOTD banner - name: Configuring MOTD banner
ios_banner: cisco.ios.ios_banner:
banner: motd banner: motd
text: | text: |
@ -58,6 +58,8 @@
servers: servers:
- server: uk.pool.ntp.org - server: uk.pool.ntp.org
version: 2 version: 2
- server: 172.16.1.112
version: 2
state: merged state: merged
- name: Configuring logging levels - name: Configuring logging levels
@ -71,7 +73,7 @@
state: merged state: merged
- name: Configuring hostname and domain settings - name: Configuring hostname and domain settings
ios_system: cisco.ios.ios_system:
hostname: "ANSIBLE-{{ current_config.ansible_facts.ansible_net_model }}" hostname: "ANSIBLE-{{ current_config.ansible_facts.ansible_net_model }}"
domain_name: siplab.net domain_name: siplab.net
lookup_enabled: yes lookup_enabled: yes
@ -79,17 +81,20 @@
- 10.30.10.250 - 10.30.10.250
- 8.8.8.8 - 8.8.8.8
- name: Configuring user account for automation jobs - name: Configuring console and VTY settings
ios_user: cisco.ios.ios_config:
name: ansible_user lines:
hashed_password: - authorization exec default
type: 9 - login authentication default
value: $9$CvE4F0G0ZTgz7E$Gj2TQ4HJasemYExfmYnAyJQzkGvLVqlGtcfWt3ZfVcI - logging synchronous
privilege: 15 parents:
state: present - "{{ item }}"
with_items:
- line vty 0 15
- line con 0
- name: Configuring system settings and commit changes to startup-config - name: Configuring final system settings [AAA, services, timezone] and committing changes to startup-config
ios_config: cisco.ios.ios_config:
lines: lines:
- service timestamps debug datetime msec localtime show-timezone - service timestamps debug datetime msec localtime show-timezone
- service timestamps log datetime msec localtime show-timezone - service timestamps log datetime msec localtime show-timezone

View File

@ -1,7 +1,7 @@
baguleykit: baguleykit:
hosts: hosts:
10.11.245.1: 10.11.245.1:
172.16.1.90:
homekit: homekit:
hosts: hosts:
192.168.1.60: 192.168.1.60:

View File

@ -0,0 +1,17 @@
- name: Remove user from local database
hosts: baguleykit
gather_facts: false
connection: network_cli
roles:
- common
tasks:
- name: Removing user 'ansible_user' from database
cisco.ios.ios_user:
name: ansible_user
state: absent
- name: Save changes to startup config
cisco.ios.ios_config:
save_when: modified

View File

@ -1,14 +1,14 @@
$ANSIBLE_VAULT;1.1;AES256 $ANSIBLE_VAULT;1.1;AES256
36346232356431333538393163356337316264323466613066386161383765613837313361623732 38353261336637653732396635643731326630326163323563666437343462323731316538333832
3933393635653661653234663932386231386462636633310a393465383862313435626439396635 3366663165643264336165623464306664656632383163320a626630323461343863653866383736
38623336326432666664616264303364313862616130656265363530643664666464646662653437 35363831313434623535356362643730663231656263323730626237386337663365653965326463
3764366163333936300a616235666566333930643638353862636530306633343434333733626365 6137303466653031310a353832373838363435333430623431656465353934393832323265663239
63393336366331323039303938623834343663346161383536623439346165303162363032353166 38643432346531306334306563343365633835396564646330366338666132313162613033323565
31303439383865646533663238336639366134323834326335336261646136306634333639313661 36336337393266333339363236336431313165666639636330663565626262386330383337313630
39663862363137646230663363333530316338393764373339636662626566393332643362363634 39333736383630623536613664303131663564343734313765333364303665663937376363396366
64663261393366613130616463383034383066333763666564346335643634626138633165366531 64383763636163626364666666383335653339623638613332646563353864356131313538343764
30386238373232333732316534623665333466626130363965303431636633653364376531616632 65376135323736343539326538346432623431303533353730613066386230363861353332366463
64393363646135396566653233653538633536376666353734386665346634666133653434656333 61613039653233393532376166333935623761383133343334343462343832393933353831393839
32333736346362626461643162646633646537396263386536336134636661646563313264616436 37333134633964313065313932326365616230313361656137323137393937393935633366313636
30316665303963323733353734333863366235393863653039306236303162383732393862643064 63343566616564313464643662303762643033326339633938616537333638666333623434353732
3861 6562