Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kubespray
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
Kubespray
Commits
2d194af8
Unverified
Commit
2d194af8
authored
9 months ago
by
Lihai Tu
Committed by
GitHub
9 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Limit nodes in gather ansible_default_ipv4 (#11370)
Signed-off-by:
tu1h
<
lihai.tu@daocloud.io
>
parent
8022eddb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roles/kubespray-defaults/tasks/fallback_ips.yml
+4
-3
4 additions, 3 deletions
roles/kubespray-defaults/tasks/fallback_ips.yml
with
4 additions
and
3 deletions
roles/kubespray-defaults/tasks/fallback_ips.yml
+
4
−
3
View file @
2d194af8
...
@@ -3,14 +3,14 @@
...
@@ -3,14 +3,14 @@
# ansible_default_ipv4 isn't what you think.
# ansible_default_ipv4 isn't what you think.
# Thanks https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
# Thanks https://medium.com/opsops/ansible-default-ipv4-is-not-what-you-think-edb8ab154b10
-
name
:
Gather ansible_default_ipv4 from all hosts
-
name
:
Gather ansible_default_ipv4 from all hosts
or specific hosts
setup
:
setup
:
gather_subset
:
'
!all,network'
gather_subset
:
'
!all,network'
filter
:
"
ansible_default_ipv4"
filter
:
"
ansible_default_ipv4"
delegate_to
:
"
{{
item
}}"
delegate_to
:
"
{{
item
}}"
delegate_facts
:
yes
delegate_facts
:
yes
when
:
hostvars[item].ansible_default_ipv4 is not defined
when
:
hostvars[item].ansible_default_ipv4 is not defined
loop
:
"
{{
(groups['k8s_cluster']
|
default([])
+
groups['etcd']
|
default([])
+
groups['calico_rr']
|
default([]))
|
unique
}}"
loop
:
"
{{
(ansible_play_hosts_all
+
[groups['kube_control_plane'][0]])
|
unique
if
ansible_limit
is
defined
else
(groups['k8s_cluster']
|
default([])
+
groups['etcd']
|
default([])
+
groups['calico_rr']
|
default([]))
|
unique
}}"
run_once
:
yes
run_once
:
yes
ignore_unreachable
:
true
ignore_unreachable
:
true
tags
:
always
tags
:
always
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
set_fact
:
set_fact
:
fallback_ips_base
:
|
fallback_ips_base
:
|
---
---
{% for item in (groups['k8s_cluster'] | default([]) + groups['etcd'] | default([]) + groups['calico_rr'] | default([])) | unique %}
{% set search_hosts = (ansible_play_hosts_all + [groups['kube_control_plane'][0]]) | unique if ansible_limit is defined else (groups['k8s_cluster'] | default([]) + groups['etcd'] | default([]) + groups['calico_rr'] | default([])) | unique %}
{% for item in search_hosts %}
{% set found = hostvars[item].get('ansible_default_ipv4') %}
{% set found = hostvars[item].get('ansible_default_ipv4') %}
{{ item }}: "{{ found.get('address', '127.0.0.1') }}"
{{ item }}: "{{ found.get('address', '127.0.0.1') }}"
{% endfor %}
{% endfor %}
...
...
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