Skip to content

Commit 6c2a2d1

Browse files
committed
Added ansible playbook example
1 parent a5e26a9 commit 6c2a2d1

4 files changed

Lines changed: 32 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[routers]
2+
r1 ansible_user="admin" ansible_password="admin" ansible_host=10.10.20.170 ansible_port=2222 hostname=r1
3+
r2 ansible_user="admin" ansible_password="admin" ansible_host=10.10.20.170 ansible_port=2232 hostname=r2
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
- hosts: routers
3+
strategy: debug
4+
become: yes
5+
gather_facts: no
6+
7+
tasks:
8+
- debug: msg="hostname={{hostname}}"
9+
- name: Copy Config file to router
10+
copy: src=./{{ hostname }}/configure_loopback2 dest=/home/admin/configure_loopback2 owner=admin force=yes
11+
12+
- name: Configure loopback2 using config merge
13+
shell: source /pkg/bin/ztp_helper.sh && xrapply /home/admin/configure_loopback2
14+
15+
- name: Verify configuration
16+
shell: source /pkg/bin/ztp_helper.sh && xrcmd "show configuration running-config interface loopback2"
17+
register: output
18+
19+
- debug: msg=output.stdout_lines
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
!
2+
interface loopback2
3+
ipv4 address 100.100.100.100/24
4+
!
5+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
!
2+
interface loopback2
3+
ipv4 address 200.200.200.200/24
4+
!
5+
end

0 commit comments

Comments
 (0)