Skip to content

Commit

Permalink
Fix ansible-lint rule violations
Browse files Browse the repository at this point in the history
  • Loading branch information
ansible-code-bot[bot] committed Nov 28, 2023
1 parent 54ecc69 commit 89b3494
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 36 deletions.
4 changes: 2 additions & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
authors:
- Rohit Thakur (rohitthakur2590)
dependencies:
"ansible.netcommon": ">=5.1.1"
"ansible.utils": ">=2.7.0"
ansible.netcommon: ">=5.1.1"
ansible.utils: ">=2.7.0"
license_file: LICENSE
name: bgp
description: Ansible Network BGP enables user to manage the BGP resources independent of platforms and perform BGP health checks.
Expand Down
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'configure'
operation: configure

Check failure on line 6 in roles/run/tasks/includes/configure.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: operation)
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'deploy'
operation: deploy

Check failure on line 9 in roles/run/tasks/includes/deploy.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: operation)

Check failure on line 9 in roles/run/tasks/includes/deploy.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: resources)
resources: "{{ bgp_resources }}"
4 changes: 2 additions & 2 deletions roles/run/tasks/includes/detect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'detect'
state: 'replaced'
operation: detect

Check failure on line 9 in roles/run/tasks/includes/detect.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: operation)

Check failure on line 9 in roles/run/tasks/includes/detect.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: resources)

Check failure on line 9 in roles/run/tasks/includes/detect.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: state)
state: replaced
resources: "{{ bgp_resources }}"
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/gather.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'gather'
operation: gather

Check failure on line 9 in roles/run/tasks/includes/gather.yaml

View workflow job for this annotation

GitHub Actions / ansible-lint / ansible-lint

var-naming[no-role-prefix]

Variables names from within roles should use role_name_ as a prefix. (vars: operation)
resources: "{{ bgp_resources }}"
4 changes: 2 additions & 2 deletions roles/run/tasks/includes/health_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

- name: Set health checks fact
ansible.builtin.set_fact:
health_checks: "{{ bgp_health | network.bgp.health_check_view(operation) }}"
health_checks: "{{ bgp_health | network.bgp.health_check_view(operation) }}"

- name: BGP health checks
ansible.builtin.debug:
var: health_checks
var: health_checks
failed_when: "'unsuccessful' == health_checks.status"
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/health_checks/eos.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show ip bgp summary"
command: show ip bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/health_checks/ios.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show bgp summary"
command: show bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/health_checks/iosxr.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show bgp summary"
command: show bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health
3 changes: 1 addition & 2 deletions roles/run/tasks/includes/health_checks/junos.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show bgp summary"
command: show bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health


- name: Show Summary facts
ansible.builtin.debug:
msg: "{{ bgp_health }}"
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/health_checks/nxos.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show ip bgp summary"
command: show ip bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/health_checks/vyos.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Parse bgp summary
ansible.utils.cli_parse:
command: "show ip bgp summary"
command: show ip bgp summary
parser:
name: ansible.netcommon.content_templates
set_fact: bgp_health
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'list'
operation: list
2 changes: 1 addition & 1 deletion roles/run/tasks/includes/persist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'persist'
operation: persist
resources: "{{ bgp_resources }}"
ignore_empty: "{{ persist_empty | default(true) }}"
4 changes: 2 additions & 2 deletions roles/run/tasks/includes/remediate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
ansible.builtin.include_role:
name: network.base.resource_manager
vars:
operation: 'remediate'
state: 'replaced'
operation: remediate
state: replaced
resources: "{{ bgp_resources }}"
10 changes: 5 additions & 5 deletions roles/run/tasks/includes/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
- name: Set resources
ansible.builtin.set_fact:
bgp_resources:
- 'bgp_global'
- 'bgp_address_family'
- 'bgp_neighbor_address_family'
- bgp_global
- bgp_address_family
- bgp_neighbor_address_family
when: ansible_network_os == 'cisco.nxos.nxos'

- name: Set resources
ansible.builtin.set_fact:
bgp_resources:
- 'bgp_global'
- 'bgp_address_family'
- bgp_global
- bgp_address_family
when: ansible_network_os != 'cisco.nxos.nxos'
21 changes: 10 additions & 11 deletions tests/bgp/roles/tests/tasks/health_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,44 @@
msg_rcvd: 73271
msg_sent: 73233
output_queue: 0
peer: "12.0.0.1"
peer: 12.0.0.1
peer_as: 500
peer_state: 1
uptime: "6w4d"
uptime: 6w4d
version: 4

- bgp_table_version: 1
input_queue: 0
msg_rcvd: 0
msg_sent: 0
output_queue: 0
peer: "23.0.0.1"
peer: 23.0.0.1
peer_as: 500
peer_state: "Idle"
uptime: "never"
peer_state: Idle
uptime: never
version: 4
path:
memory_usage: 288
total_entries: 2

route_table_version: 3
router_id: "22.0.0.1"
router_id: 22.0.0.1

- name: Vars
ansible.builtin.set_fact:
tests_item:
name: "health_check"
name: health_check
vars:
checks:
- name: "all_neighbors_up"
- name: "all_neighbors_down"
- name: "min_neighbors_up"
- name: all_neighbors_up
- name: all_neighbors_down
- name: min_neighbors_up
min_count: 1

- name: Set BGP health facts
ansible.builtin.set_fact:
tests_health_checks: "{{ bgp_health | ansible.utils.health_check_view(tests_item) }}"


- name: Check for accurate facts
ansible.builtin.assert:
that: "{{ tests_health_checks == tests_expected_health_checks }}"

0 comments on commit 89b3494

Please sign in to comment.