Skip to content

Commit

Permalink
fix ansible-lint errors in playbooks directory (ansible-collections#501)
Browse files Browse the repository at this point in the history
* fix ansible-lint errors in playbooks/bgp_l3_fabric and playbooks/common_examples directories

* add changelog

* update changelog

* add a name line to clos-fabric..yaml file

* remove playbooks/common_examples fixes from PR

* update changelog

* update clos-fabric file

* delete extra period

* remove the second "sonic" in the FQCN for clos-fabric file

* update indentation

* update indentation

* fix indentation
  • Loading branch information
aida-shumburo authored Feb 5, 2025
1 parent 17df947 commit 6e673f8
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 224 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/501-fix-ansible-lint-failures-3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
trivial:
- playbooks - Fix ansible lint failures in playbooks/bgp_l3_fabric directory (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/501).
67 changes: 33 additions & 34 deletions playbooks/bgp_l3_fabric/clos-fabric.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
---
- hosts: datacenter
- name: "Configure BGP clos fabric options after configuring prerequisite options"
hosts: datacenter
gather_facts: false
connection: httpapi
gather_facts: no
collections:
- dellemc.enterprise_sonic
tasks:
- name: Create Interfaces
sonic_interfaces:
config: "{{sonic_interfaces}}"
when: sonic_interfaces is defined and sonic_interfaces
- name: Create Interfaces
dellemc.enterprise_sonic.sonic_interfaces:
config: "{{ sonic_interfaces }}"
when: sonic_interfaces is defined and sonic_interfaces

- name: Create L3 Interfaces
sonic_l3_interfaces:
config: "{{sonic_l3_interfaces}}"
when: sonic_l3_interfaces is defined and sonic_l3_interfaces
- name: Create L3 Interfaces
dellemc.enterprise_sonic.sonic_l3_interfaces:
config: "{{ sonic_l3_interfaces }}"
when: sonic_l3_interfaces is defined and sonic_l3_interfaces

- name: "Push configs for clos-fabric usecase"
vars:
ansible_connection: network_cli
sonic_config:
src: clos_fabric_cfg.j2
register: result
- name: "Push configs for clos-fabric usecase"
vars:
ansible_connection: network_cli
dellemc.enterprise_sonic.sonic_config:
src: clos_fabric_cfg.j2
register: result

- name: Create BGP configuration
sonic_bgp:
config: "{{sonic_bgp}}"
when: sonic_bgp is defined and sonic_bgp
- name: Create BGP configuration
dellemc.enterprise_sonic.sonic_bgp:
config: "{{ sonic_bgp }}"
when: sonic_bgp is defined and sonic_bgp

- name: Create BGP AF configuration
sonic_bgp_af:
config: "{{sonic_bgp_af}}"
when: sonic_bgp_af is defined and sonic_bgp_af
- name: Create BGP AF configuration
dellemc.enterprise_sonic.sonic_bgp_af:
config: "{{ sonic_bgp_af }}"
when: sonic_bgp_af is defined and sonic_bgp_af

- name: Create BGP Neighbors configuration
sonic_bgp_neighbors:
config: "{{sonic_bgp_neighbors}}"
when: sonic_bgp_neighbors is defined and sonic_bgp_neighbors
- name: Create BGP Neighbors configuration
dellemc.enterprise_sonic.sonic_bgp_neighbors:
config: "{{ sonic_bgp_neighbors }}"
when: sonic_bgp_neighbors is defined and sonic_bgp_neighbors

- name: Create BGP Neighbors AF configuration
sonic_bgp_neighbors_af:
config: "{{sonic_bgp_neighbors_af}}"
when: sonic_bgp_neighbors_af is defined and sonic_bgp_neighbors_af
- name: Create BGP Neighbors AF configuration
dellemc.enterprise_sonic.sonic_bgp_neighbors_af:
config: "{{ sonic_bgp_neighbors_af }}"
when: sonic_bgp_neighbors_af is defined and sonic_bgp_neighbors_af
49 changes: 25 additions & 24 deletions playbooks/bgp_l3_fabric/group_vars/all.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
ansible_user: admin
ansible_password: admin
ansible_password: admin
ansible_network_os: dellemc.enterprise_sonic.sonic

# Changing the interface name here will be reflected in all places
Expand All @@ -18,32 +19,32 @@ loopback_inf0: Loopback0
loopback_inf1: Loopback1

host_data:
leaf1:
loopback0_ip: 10.0.2.1/32
loopback1_ip: 10.10.10.1/32
bgp_asn: 65001
leaf2:
loopback0_ip: 10.0.2.2/32
loopback1_ip: 10.10.10.2/32
bgp_asn: 65001
leaf25:
loopback0_ip: 10.0.2.25/32
loopback1_ip: 10.10.10.25/32
bgp_asn: 65025
leaf26:
loopback0_ip: 10.0.2.26/32
loopback1_ip: 10.10.10.26/32
bgp_asn: 65025
spine1:
loopback0_ip: 10.0.1.1/32
bgp_asn: 65000
spine2:
loopback0_ip: 10.0.1.2/32
bgp_asn: 65000
leaf1:
loopback0_ip: 10.0.2.1/32
loopback1_ip: 10.10.10.1/32
bgp_asn: 65001
leaf2:
loopback0_ip: 10.0.2.2/32
loopback1_ip: 10.10.10.2/32
bgp_asn: 65001
leaf25:
loopback0_ip: 10.0.2.25/32
loopback1_ip: 10.10.10.25/32
bgp_asn: 65025
leaf26:
loopback0_ip: 10.0.2.26/32
loopback1_ip: 10.10.10.26/32
bgp_asn: 65025
spine1:
loopback0_ip: 10.0.1.1/32
bgp_asn: 65000
spine2:
loopback0_ip: 10.0.1.2/32
bgp_asn: 65000

ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: false

loopback0_ip: "{{ host_data[inventory_hostname].loopback0_ip }}"
loopback1_ip: "{{host_data[inventory_hostname].loopback1_ip}}"
loopback1_ip: "{{ host_data[inventory_hostname].loopback1_ip }}"
bgp_asn: "{{ host_data[inventory_hostname].bgp_asn }}"
149 changes: 75 additions & 74 deletions playbooks/bgp_l3_fabric/group_vars/leaf.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
---
sonic_interfaces:
- name: "{{ leaf_spine1_inf1 }}"
description: "{{ leaf_spine1_inf1 }} Spine1"
enabled: true
- name: "{{ leaf_spine2_inf2 }}"
description: "{{ leaf_spine2_inf2 }} Spine2"
enabled: true
- name: "{{ loopback_inf0 }}"
- name: "{{ loopback_inf1 }}"
- name: "{{ leaf_spine1_inf1 }}"
description: "{{ leaf_spine1_inf1 }} Spine1"
enabled: true
- name: "{{ leaf_spine2_inf2 }}"
description: "{{ leaf_spine2_inf2 }} Spine2"
enabled: true
- name: "{{ loopback_inf0 }}"
- name: "{{ loopback_inf1 }}"

sonic_l3_interfaces:
- name: "{{ loopback_inf0 }}"
ipv4:
addresses:
- name: "{{ loopback_inf0 }}"
ipv4:
addresses:
- address: "{{ loopback0_ip }}"
- name: "{{ loopback_inf1 }}"
ipv4:
addresses:
- name: "{{ loopback_inf1 }}"
ipv4:
addresses:
- address: "{{ loopback1_ip }}"
- name: "{{ leaf_spine1_inf1 }}"
ipv6:
enabled: true
- name: "{{ leaf_spine2_inf2 }}"
ipv6:
enabled: true
- name: "{{ leaf_spine1_inf1 }}"
ipv6:
enabled: true
- name: "{{ leaf_spine2_inf2 }}"
ipv6:
enabled: true

sonic_route_maps_cli:
- name: REDISTU
Expand All @@ -38,66 +39,66 @@ sonic_prefix_list_cli:
- name: UNDERLAY
permit: true
entries:
- ip: 10.0.2.0/24
condition: ge 32 le 32
seq: 1
- ip: 10.10.10.0/24
condition: ge 32 le 32
seq: 2
- ip: 10.0.2.0/24
condition: ge 32 le 32
seq: 1
- ip: 10.10.10.0/24
condition: ge 32 le 32
seq: 2
- name: L3OVERLAY
permit: true
entries:
- ip: 192.168.50.0/24
seq: 3
- ip: 192.168.50.0/24
seq: 3

sonic_bgp:
- bgp_as: "{{ bgp_asn }}"
router_id: "{{ loopback0_ip.split('/')[0] }}"
bestpath:
as_path:
multipath_relax: true
- bgp_as: "{{ bgp_asn }}"
router_id: "{{ loopback0_ip.split('/')[0] }}"
bestpath:
as_path:
multipath_relax: true

sonic_bgp_af:
- bgp_as: "{{ bgp_asn }}"
address_family:
afis:
- afi: l2vpn
safi: evpn
advertise_all_vni: true
- afi: ipv4
safi: unicast
redistribute:
- protocol: connected
route_map: REDISTU
- bgp_as: "{{ bgp_asn }}"
address_family:
afis:
- afi: l2vpn
safi: evpn
advertise_all_vni: true
- afi: ipv4
safi: unicast
redistribute:
- protocol: connected
route_map: REDISTU

sonic_bgp_neighbors:
- bgp_as: "{{ bgp_asn }}"
peer_group:
- name: SPINE
remote_as:
peer_type: external
advertisement_interval: 5
timers:
keepalive: 3
holdtime: 9
bfd:
check_failure: true
enabled: true
profile: 'profile 1'
capability:
extended_nexthop: true
address_family:
afis:
- afi: l2vpn
safi: evpn
activate: true
- afi: ipv4
safi: unicast
activate: true
allowas_in:
value: 2
neighbors:
- neighbor: "{{ leaf_spine1_inf1 }}"
peer_group: SPINE
- neighbor: "{{ leaf_spine2_inf2 }}"
peer_group: SPINE
- bgp_as: "{{ bgp_asn }}"
peer_group:
- name: SPINE
remote_as:
peer_type: external
advertisement_interval: 5
timers:
keepalive: 3
holdtime: 9
bfd:
check_failure: true
enabled: true
profile: 'profile 1'
capability:
extended_nexthop: true
address_family:
afis:
- afi: l2vpn
safi: evpn
activate: true
- afi: ipv4
safi: unicast
activate: true
allowas_in:
value: 2
neighbors:
- neighbor: "{{ leaf_spine1_inf1 }}"
peer_group: SPINE
- neighbor: "{{ leaf_spine2_inf2 }}"
peer_group: SPINE
Loading

0 comments on commit 6e673f8

Please sign in to comment.