File tree Expand file tree Collapse file tree
01-iosxr-01-cli-automation-bash/ztp_bash/ansible Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1+ !
2+ interface loopback2
3+ ipv4 address 100.100.100.100/24
4+ !
5+ end
Original file line number Diff line number Diff line change 1+ !
2+ interface loopback2
3+ ipv4 address 200.200.200.200/24
4+ !
5+ end
You can’t perform that action at this time.
0 commit comments