storage_interface problem
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
kolla |
Fix Released
|
Critical
|
Bartłomiej Daca | ||
Liberty |
Won't Fix
|
Critical
|
Paul Bourke | ||
Mitaka |
Won't Fix
|
Critical
|
Paul Bourke |
Bug Description
This bug is connected with bug #1586524 and bug #1603885. It is only valid for versions liberty and mitaka. It does not affect master, because master uses ansible 2.0 and this bug is connected with ansible < 2.0.0.
So, first let's forget about kolla and focus on ansible( version 1.9.X ):
First, create three files:
cat <<'EOF' > globals.yml
testing_var: "from global.yml"
EOF
cat <<'EOF' > inventory
[a]
gs0104 testing_var="from inventory, only for this host"
gs0105
gs0106
[a:vars]
testing_var="from inventory, for group a"
EOF
cat <<'EOF' > test.yml
- name: testing
hosts: all
tasks:
- debug:
msg: "global context: '{{ testing_var }}'; hostvars context: '{{ hostvars[
EOF
command: ansible-playbook -i inventory -e @./globals.yml test.yml
Expected output:
...
ok: [gs0106] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from global.yml'"
}
ok: [gs0104] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from global.yml'"
}
ok: [gs0105] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from global.yml'"
}
...
Actual output:
...
ok: [gs0104] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from inventory, only for this host'"
}
ok: [gs0106] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from inventory, for group a'"
}
ok: [gs0105] => {
"msg": "global context: 'from global.yml'; hostvars context: 'from inventory, for group a'"
}
...
As one can see, extra vars provided in file 'globals.yml' do not propagate to hostvars.
Going back to kolla (only liberty and mitaka versions), see the file ansible/
{% for host in groups['ceph-mon'] %}{{ hostvars[
These loops will generate wrong output when one will specify custom storage_interface. In the output one will see addresses from api_interface, not from the storage_interface, because storage_interface is read from hostvars (just like in this pure-ansible example above).
By changing the way of getting to storage_interface value in these three loops from:
{{ hostvars[
to
{{ hostvars[
we can fix this problem. But this solution will create another bug:
If ceph-mon group will looks like this in inventory:
[ceph-mon]
gs0104
gs0105
gs0106 storage_
and the storage_interface will be specified in globals.yml as 'eth1', then the content of the ceph.conf will be invalid again. And this looks like won't fix to me.
To summerize:
# I suggest changing the ansible/
# Maybe this missbehaviour should be documented somehow?
Changed in kolla: | |
importance: | Undecided → Critical |
status: | New → Triaged |
Changed in kolla: | |
assignee: | nobody → Bartłomiej Daca (bartek-daca) |
Changed in kolla: | |
milestone: | none → newton-3 |
I think the statement that it will not affect master is wrong unfortunately...
In master:
Just like in the pure-ansible example, everything specified in extra-vars is on the top, so when one will specify storage_interface both in globals.yml and inventory, only globals.yml will be taken into consideration. But I am not sure if it is a bug, because it works exactly as it should, according to ansible documentation. Maybe it should be described in kolla documentation, because on the one hand we can see all this *_interface vars in global.yml, and on the other hand there are two lines in multinode inventory:
# you can specify "api_interface" and another interfaces like below: external_ interface= eth0 api_interface=em1 storage_ interface= em1 tunnel_ interface= em1
#compute01 neutron_
Hence, it should be specified either in global.yml if the value is proper for all hosts, or in inventory if the value may vary between hosts.