<div dir="ltr">Hi Markus,<div><br></div><div>I think you can achieve what you want by simple overriding the host variables, for example:</div><div><br></div><div>In <span style="color:rgb(33,33,33)">/etc/openstack_deploy/openstac</span><span style="color:rgb(33,33,33)">k_user_config.yml:</span></div><div></div><div dir="ltr"><div><div><font face="monospace">compute_hosts:</font></div><div><font face="monospace">   compute1:</font></div><div><font face="monospace">     ip: 192.168.100.12</font></div><div><font face="monospace">     host_vars:</font></div></div></div><div dir="ltr"><div><div><font face="monospace">       nova_reserved_host_memory_mb: 256</font></div><div><font face="monospace">   compute2:</font></div><div><font face="monospace">     ip: <span style="color:rgb(33,33,33)">192.168.100.10</span></font></div><div><br></div></div><div>In this case you would have compute1 with <span style="color:rgb(33,33,33)">reserved_host_memory_mb = 256 and compute2 with the default value s</span>et for nova_reserved_host_memory_mb.</div><div><br></div></div><div dir="ltr"><div><br></div><div>Flávio</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Aug 21, 2017 at 6:09 PM Markus Zoeller <<a href="mailto:mzoeller@linux.vnet.ibm.com" target="_blank">mzoeller@linux.vnet.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 21.08.2017 16:40, Andy McCrae wrote:<br>
> Hey Markus,<br>
><br>
><br>
>> I'm wondering which possibilities I have to do group/host specific<br>
>> config file overrides. After reading [1], I'm still a little clueless.<br>
>> To be specific, I have this setup (expressed as Ansible inventory file):<br>
>><br>
>>     [z_compute_nodes]<br>
>>     compute1<br>
>>     # more nodes<br>
>>     [x_compute_nodes]<br>
>>     compute2<br>
>>     # more nodes<br>
>>     [computes:children]<br>
>>     z_compute_nodes<br>
>>     x_compute_nodes<br>
>><br>
>> As an example, I want to set Nova's config option<br>
>> `reserved_host_memory_mb` of the `DEFAULT` config file section:<br>
>><br>
>>     ### nova.conf<br>
>>     [DEFAULT]<br>
>>     reserved_host_memory_mb=$VALUE<br>
>><br>
>> My goal is this:<br>
>><br>
>>              | reserved_host_memory_mb<br>
>>     ----------------------------------<br>
>>     compute1 |         256<br>
>>     compute2 |         512<br>
>><br>
>> I know there are overrides like `nova_nova_conf_overrides`.<br>
>> So I tried to set a default override in `user_variables.yml`:<br>
>><br>
>>     ### /etc/openstack_deploy/user_variables.yml --------<br>
>><br>
>>     nova_nova_conf_overrides:<br>
>>       DEFAULT:<br>
>>         reserved_host_memory_mb: 512<br>
>><br>
>> But I wanted to override this depending on the host in<br>
>> `openstack_user_config.yml`:<br>
>><br>
>>     ### /etc/openstack_deploy/openstack_user_config.yml --------<br>
>>     # [...]<br>
>>     # nova hypervisors<br>
>>     compute_hosts:<br>
>>       compute1:<br>
>>         ip: 192.168.100.12<br>
>>         host_vars:<br>
>>           nova_nova_conf_overrides:<br>
>>             DEFAULT:<br>
>>               reserved_host_memory_mb: 256<br>
>>       compute2:<br>
>>         ip: 192.168.100.10<br>
>><br>
><br>
> Try change "host_vars" to "container_vars".<br>
> If that doesn't work let me know, I'll spin up a test to recreate the<br>
> actual problem, but at a glance that looks correct otherwise.<br>
><br>
<br>
<br>
Replacing `host_vars` with `container_vars` didn't have an effect:<br>
<br>
    ### controller1: /etc/openstack_deploy/openstack_user_config.yml<br>
    # nova hypervisors<br>
    compute_hosts:<br>
      compute1:<br>
        ip: 192.168.100.12<br>
        container_vars:<br>
          nova_nova_conf_overrides:<br>
                DEFAULT:<br>
                    reserved_host_memory_mb: 256<br>
      compute2:<br>
        ip: 192.168.100.10<br>
<br>
Both compute nodes still have the same $VALUE, although `compute1`<br>
should have 256:<br>
<br>
    ### compute1: /etc/nova/nova.conf<br>
    root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf<br>
    reserved_host_memory_mb = 512<br>
<br>
<br>
    ### compute2: /etc/nova/nova.conf<br>
    root@compute2:~# grep reserved_host_memory_mb /etc/nova/nova.conf<br>
    reserved_host_memory_mb = 512<br>
<br>
I'd like to avoid to introduce some "clever" dict merging algorithm I<br>
won't understand anymore after a few weeks. :/<br>
<br>
Any hint is appreciated!<br>
<br>
--<br>
Regards, Markus Zoeller (markus_z)<br>
<br>
>><br>
>> After testing this locally, it turned out that *both* hosts will<br>
>> have 512 for $VALUE. which was not my intended configuration.<br>
>><br>
>> Please note that I only used 2 hosts here as an example but I'm looking<br>
>> for a solution which scales with much more hosts. I'm also applying<br>
>> those settings in a templated way like this:<br>
>><br>
>>     ### /etc/openstack_deploy/openstack_user_config.yml --------<br>
>>     # [...]<br>
>>     # nova hypervisors<br>
>>     compute_hosts:<br>
>>     {% for host in groups['computes'] %}<br>
>>       {{ hostvars[host]['inventory_hostname'] }}:<br>
>>         ip: {{ hostvars[host]['ansible_host'] }}<br>
>>     {% endfor %}<br>
>><br>
>> The reason is, that I use the same steps for different environments<br>
>> (dev, test, prod) with a different amount of nodes.<br>
>><br>
>> Any tips how to do this properly?<br>
>><br>
>><br>
> Andy<br>
><br>
><br>
><br>
> __________________________________________________________________________<br>
> OpenStack Development Mailing List (not for usage questions)<br>
> Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
><br>
<br>
<br>
<br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote></div></div>