Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
Kolla Ansible
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Very Demiurge Very Mindful
Kolla Ansible
Commits
81606a1b
Commit
81606a1b
authored
6 years ago
by
Zuul
Committed by
Gerrit Code Review
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix fact gathering with --limit"
parents
57f069a3
56b4352f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ansible/gather-facts.yml
+44
-0
44 additions, 0 deletions
ansible/gather-facts.yml
ansible/kolla-host.yml
+1
-31
1 addition, 31 deletions
ansible/kolla-host.yml
ansible/site.yml
+1
-32
1 addition, 32 deletions
ansible/site.yml
with
46 additions
and
63 deletions
ansible/gather-facts.yml
0 → 100644
+
44
−
0
View file @
81606a1b
---
# NOTE(awiddersheim): Gather facts for all hosts as a
# first step since several plays below require them when
# building their configurations. The below 'gather_facts'
# set to 'false' is a bit confusing but this is to avoid
# Ansible gathering facts twice.
-
name
:
Gather facts for all hosts
hosts
:
all
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
tasks
:
-
name
:
Gather facts
setup
:
-
name
:
Group hosts to determine when using --limit
group_by
:
key
:
"
all_using_limit_{{
(ansible_play_batch
|
length)
!=
(groups['all']
|
length)
}}"
tags
:
always
# NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The
# limit arg will cause the first play to gather facts only about that node,
# meaning facts such as IP addresses for rabbitmq nodes etc. will be undefined
# in the case of adding a single compute node.
# NOTE(mgoddard): Divide all hosts to be queried between the hosts selected via
# the limit.
-
name
:
Gather facts for all hosts (if using --limit)
hosts
:
all_using_limit_True
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
vars
:
batch_index
:
"
{{
ansible_play_batch.index(inventory_hostname)
}}"
batch_size
:
"
{{
ansible_play_batch
|
length
}}"
# Use a python list slice to divide the group up.
# Syntax: [<start index>:<end index>:<step size>]
delegate_hosts
:
"
{{
groups['all'][batch_index
|
int::batch_size
|
int]
}}"
tasks
:
-
name
:
Gather facts
setup
:
delegate_facts
:
True
delegate_to
:
"
{{
item
}}"
with_items
:
"
{{
delegate_hosts
}}"
# We gathered facts for all hosts in the batch during the first play.
when
:
item not in ansible_play_batch
tags
:
always
This diff is collapsed.
Click to expand it.
ansible/kolla-host.yml
+
1
−
31
View file @
81606a1b
---
# NOTE(awiddersheim): Gather facts for all hosts as a
# first step since several plays below require them when
# building their configurations. The below 'gather_facts'
# set to 'false' is a bit confusing but this is to avoid
# Ansible gathering facts twice.
-
name
:
Gather facts for all hosts
hosts
:
all
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
tasks
:
-
setup
:
tags
:
always
# NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The
# limit arg will cause the first play to gather facts only about that node,
# meaning facts such as IP addresses for rabbitmq nodes etc. will be undefined
# in the case of adding a single compute node.
# We don't want to add the delegate parameters to the above play as it will
# result in ((num_nodes-1)^2) number of SSHs when running for all nodes
# which can be very inefficient.
-
name
:
Gather facts for all hosts (if using --limit)
hosts
:
all
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
tasks
:
-
setup
:
delegate_facts
:
True
delegate_to
:
"
{{
item
}}"
with_items
:
"
{{
groups['all']
}}"
when
:
-
(ansible_play_batch | length) != (groups['all'] | length)
-
import_playbook
:
gather-facts.yml
-
name
:
Apply role baremetal
hosts
:
baremetal
...
...
This diff is collapsed.
Click to expand it.
ansible/site.yml
+
1
−
32
View file @
81606a1b
---
# NOTE(awiddersheim): Gather facts for all hosts as a
# first step since several plays below require them when
# building their configurations. The below 'gather_facts'
# set to 'false' is a bit confusing but this is to avoid
# Ansible gathering facts twice.
-
name
:
Gather facts for all hosts
hosts
:
all
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
tasks
:
-
setup
:
tags
:
always
# NOTE(pbourke): This case covers deploying subsets of hosts using --limit. The
# limit arg will cause the first play to gather facts only about that node,
# meaning facts such as IP addresses for rabbitmq nodes etc. will be undefined
# in the case of adding a single compute node.
# We don't want to add the delegate parameters to the above play as it will
# result in ((num_nodes-1)^2) number of SSHs when running for all nodes
# which can be very inefficient.
-
name
:
Gather facts for all hosts (if using --limit)
hosts
:
all
serial
:
'
{{
kolla_serial|default("0")
}}'
gather_facts
:
false
tasks
:
-
setup
:
delegate_facts
:
True
delegate_to
:
"
{{
item
}}"
with_items
:
"
{{
groups['all']
}}"
when
:
-
(ansible_play_batch | length) != (groups['all'] | length)
tags
:
always
-
import_playbook
:
gather-facts.yml
# NOTE(mgoddard): In large environments, even tasks that are skipped can take a
# significant amount of time. This is an optimisation to prevent any tasks
...
...
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