-
Notifications
You must be signed in to change notification settings - Fork 6
/
show-diff.yml
62 lines (55 loc) · 2.12 KB
/
show-diff.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
# ansible-playbook --diff show-diff.yml
- hosts: ios
gather_facts: false
tasks:
- name: Backup the config, make changes and then look at the diff
block:
- name: Backup the config
cisco.ios.ios_config:
backup: true
register: config_output
- name: Print debug message
ansible.builtin.debug:
msg: "Backup generated {{ config_output.date }} at {{ config_output.time }}"
tags: debug
- name: Configure ACL on Cisco IOS device using ios_config module
cisco.ios.ios_config:
lines:
- 10 permit ip host 192.0.2.1 any log
- 20 permit ip host 192.0.2.2 any log
- 30 permit ip host 192.0.2.3 any log
- 40 permit ip host 192.0.2.4 any log
- 50 permit ip host 192.0.2.5 any log
parents: ip access-list extended ACL-Ansible-CLI
before: no ip access-list extended test
match: exact
save_when: modified
- name: Configure ACL on Cisco IOS device using ios_acls module
cisco.ios.ios_acls:
state: replaced
config:
- afi: ipv4
acls:
- name: ACL-Ansible-RM
aces:
- sequence: 10
grant: deny
source:
any: true
destination:
address: 198.51.100.0
wildcard_bits: 0.0.0.255
protocol: tcp
- sequence: 20
grant: permit
source:
any: true
destination:
any: true
protocol: tcp
- name: Compare the Cisco IOS running-config to backup config
cisco.ios.ios_config:
diff_against: intended
intended_config: "{{ lookup('file', '{{ config_output.backup_path }}') }}"
register: diff
when: ansible_network_os == 'cisco.ios.ios'