[openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
Markus Zoeller
mzoeller at linux.vnet.ibm.com
Mon Aug 21 14:26:29 UTC 2017
I'm wondering which possibilities I have to do group/host specific
config file overrides. After reading [1], I'm still a little clueless.
To be specific, I have this setup (expressed as Ansible inventory file):
[z_compute_nodes]
compute1
# more nodes
[x_compute_nodes]
compute2
# more nodes
[computes:children]
z_compute_nodes
x_compute_nodes
As an example, I want to set Nova's config option
`reserved_host_memory_mb` of the `DEFAULT` config file section:
### nova.conf
[DEFAULT]
reserved_host_memory_mb=$VALUE
My goal is this:
| reserved_host_memory_mb
----------------------------------
compute1 | 256
compute2 | 512
I know there are overrides like `nova_nova_conf_overrides`.
So I tried to set a default override in `user_variables.yml`:
### /etc/openstack_deploy/user_variables.yml --------
nova_nova_conf_overrides:
DEFAULT:
reserved_host_memory_mb: 512
But I wanted to override this depending on the host in
`openstack_user_config.yml`:
### /etc/openstack_deploy/openstack_user_config.yml --------
# [...]
# nova hypervisors
compute_hosts:
compute1:
ip: 192.168.100.12
host_vars:
nova_nova_conf_overrides:
DEFAULT:
reserved_host_memory_mb: 256
compute2:
ip: 192.168.100.10
After testing this locally, it turned out that *both* hosts will
have 512 for $VALUE. which was not my intended configuration.
Please note that I only used 2 hosts here as an example but I'm looking
for a solution which scales with much more hosts. I'm also applying
those settings in a templated way like this:
### /etc/openstack_deploy/openstack_user_config.yml --------
# [...]
# nova hypervisors
compute_hosts:
{% for host in groups['computes'] %}
{{ hostvars[host]['inventory_hostname'] }}:
ip: {{ hostvars[host]['ansible_host'] }}
{% endfor %}
The reason is, that I use the same steps for different environments
(dev, test, prod) with a different amount of nodes.
Any tips how to do this properly?
References:
[1]
https://docs.openstack.org/project-deploy-guide/openstack-ansible/draft/app-advanced-config-override.html
--
Regards, Markus Zoeller (markus_z)
More information about the OpenStack-dev
mailing list