Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GAP Ansible Collection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GAP Ansible Collection
Commits
f0e96991
Commit
f0e96991
authored
7 months ago
by
Aleksandr Kurbatov
Browse files
Options
Downloads
Patches
Plain Diff
Make `bgpq` command a variable with default set to bgpq3
parent
eb3682b5
No related branches found
No related tags found
1 merge request
!205
Make `bgpq` command a variable with default set to bgpq3
Pipeline
#90982
passed
7 months ago
Stage: linting
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml
+12
-12
12 additions, 12 deletions
geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml
geant/gap_ansible/roles/po_prefix_lists/vars/main.yml
+2
-0
2 additions, 0 deletions
geant/gap_ansible/roles/po_prefix_lists/vars/main.yml
with
14 additions
and
12 deletions
geant/gap_ansible/roles/po_prefix_lists/tasks/main.yml
+
12
−
12
View file @
f0e96991
...
...
@@ -3,15 +3,15 @@
-
name
:
Collect prefixes and render the prefix template
delegate_to
:
localhost
block
:
-
name
:
Collect IPV4 routes from bgpq
4
ansible.builtin.command
:
bgpq4
-j4
"
{{ partner.as_set }}"
register
:
bgpq
4
_ipv4_routes_in_json
-
name
:
Collect IPV4 routes from
{{
bgpq
_ver }}
ansible.builtin.command
:
"
{{
bgpq_ver
}}
-j4
{{
partner.as_set
}}"
register
:
bgpq_ipv4_routes_in_json
changed_when
:
true
-
name
:
Convert IPV4 output to real json
ansible.builtin.set_fact
:
ipv4_prefix_list_name
:
"
{{
partner_name
|
upper
}}_{{
partner.type
}}_PREFIXES_IPV4"
routes
:
"
{{
bgpq
4
_ipv4_routes_in_json.stdout
|
from_json
}}"
routes
:
"
{{
bgpq_ipv4_routes_in_json.stdout
|
from_json
}}"
-
name
:
Fail if IPV4 routes list lenght is too short
when
:
routes.NN | length <=
1
...
...
@@ -19,19 +19,19 @@
-
name
:
Form IPV4 route object
ansible.builtin.set_fact
:
bgpq
4
_ipv4_routes
:
"
{{
bgpq
4
_ipv4_routes
|
default([])
+
[item.prefix]
}}"
bgpq_ipv4_routes
:
"
{{
bgpq_ipv4_routes
|
default([])
+
[item.prefix]
}}"
loop
:
"
{{
routes.NN
}}"
-
name
:
Collect IPV6 routes from bgpq
4
ansible.builtin.command
:
bgpq4
-j6
"
{{ partner.as_set }}"
register
:
bgpq
4
_ipv6_routes_in_json
-
name
:
Collect IPV6 routes from
{{
bgpq
_ver }}
ansible.builtin.command
:
"
{{
bgpq_ver
}}
-j6
{{
partner.as_set
}}"
register
:
bgpq_ipv6_routes_in_json
changed_when
:
true
-
name
:
Convert IPV6 outeput to real json
ansible.builtin.set_fact
:
ipv6_prefix_list_name
:
"
{{
partner_name
|
upper
}}_{{
partner.type
}}_PREFIXES_IPV6"
routes
:
"
{{
bgpq
4
_ipv6_routes_in_json.stdout
|
from_json
}}"
routes
:
"
{{
bgpq_ipv6_routes_in_json.stdout
|
from_json
}}"
-
name
:
Fail if IPV6 routes list lenght is too short
when
:
routes.NN | length <=
1
...
...
@@ -39,13 +39,13 @@
-
name
:
Form IPV6 route object
ansible.builtin.set_fact
:
bgpq
4
_ipv6_routes
:
"
{{
bgpq
4
_ipv6_routes
|
default([])
+
[item.prefix]
}}"
bgpq_ipv6_routes
:
"
{{
bgpq_ipv6_routes
|
default([])
+
[item.prefix]
}}"
loop
:
"
{{
routes.NN
}}"
-
name
:
Put everything together
ansible.builtin.set_fact
:
nren_prefix_lists
:
"
{{
nren_prefix_lists
|
default([])
+
[{'name':
ipv4_prefix_list_name,
'prefixes':
bgpq
4
_ipv4_routes},
{'name':
ipv6_prefix_list_name,
'prefixes':
bgpq
4
_ipv6_routes}]
}}"
nren_prefix_lists
:
"
{{
nren_prefix_lists
|
default([])
+
[{'name':
ipv4_prefix_list_name,
'prefixes':
bgpq_ipv4_routes},
{'name':
ipv6_prefix_list_name,
'prefixes':
bgpq_ipv6_routes}]
}}"
-
name
:
Print the template in "/var/tmp/ansible_run_{{ opid }}/{{ partner_name }}_prefix_lists.conf"
ansible.builtin.template
:
...
...
This diff is collapsed.
Click to expand it.
geant/gap_ansible/roles/po_prefix_lists/vars/main.yml
+
2
−
0
View file @
f0e96991
---
# vars file for prefix_lists
is_standalone_run
:
false
bgpq_ver
:
bgpq3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment