forked from hans-vvv/NetAutLab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook4.yml
33 lines (27 loc) · 891 Bytes
/
playbook4.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
- name: Rebuild inventory to final phase...
hosts: all
tasks:
- name: load external data model
xls_to_facts:
src="Map1.xlsx"
run_once: true
- name: Find MAC address of Network elements
ios_command:
commands: show interface eth0/2 | i Hardware is AmdP2
register: mac_result
- set_fact:
found_mac: |
{{mac_result.stdout_lines[0] |
map('regex_findall','^Hardware is AmdP2, address is ([a-zA-Z0-9]{4}\.[a-zA-Z0-9]{4}\.[a-zA-Z0-9]{4})') |
join }}
- name: Create configuration hostfile phase 2
template: src=./templates/hosts-phase2.j2 dest=./configs/{{inventory_hostname}}-hosts-phase2.cfg
check_mode: no
- name: Activate hostfile phase 2
assemble:
src: ./configs/
regexp: '.*hosts-phase2.*'
dest: ./hosts
delegate_to: localhost
run_once: true
- meta: refresh_inventory