[openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
Andy McCrae
andy.mccrae at gmail.com
Mon Aug 21 14:40:53 UTC 2017
Hey Markus,
> 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
>
Try change "host_vars" to "container_vars".
If that doesn't work let me know, I'll spin up a test to recreate the
actual problem, but at a glance that looks correct otherwise.
>
> 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?
>
>
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20170821/46ec904f/attachment.html>
More information about the OpenStack-dev
mailing list