<div dir="ltr">Hello, <div><br></div><div>The variables documented in each of the roles defaults/ are generally what you can consider a user level interface (i.e.: what you can modify), while the variables from vars/ are generally what's best to avoid overriding.</div><div><br><div>We've been slowly phasing out variables insides templates, to exclusively rely on config_template overrides (See also: [1] and [2])</div><div>Please note that if a variable is deprecated, we are issuing a release note.<br></div><div><br></div><div>[1]: <a href="https://github.com/openstack/openstack-ansible-os_nova/blob/4b9100a612ba0e9449d792b2783b9ec50a8fb28e/tasks/nova_post_install.yml#L40" target="_blank">https://github.com/openstack/<wbr>openstack-ansible-os_nova/<wbr>blob/<wbr>4b9100a612ba0e9449d792b2783b9e<wbr>c50a8fb28e/tasks/nova_post_<wbr>install.yml#L40</a></div><div>[2]: <a href="https://docs.openstack.org/project-deploy-guide/openstack-ansible/ocata/app-advanced-config-override.html" target="_blank">https://docs.openstack.org/<wbr>project-deploy-guide/<wbr>openstack-ansible/ocata/app-<wbr>advanced-config-override.html</a> </div><div><br></div><div>Best regards,</div><div>JP</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 22, 2017 at 1:24 PM, Markus Zoeller <span dir="ltr"><<a href="mailto:mzoeller@linux.vnet.ibm.com" target="_blank">mzoeller@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 22.08.2017 09:46, Flávio Ramalho wrote:<br>
> Hi Markus,<br>
><br>
> I think you can achieve what you want by simple overriding the host<br>
> variables, for example:<br>
><br>
> In /etc/openstack_deploy/openstac<wbr>k_user_config.yml:<br>
> compute_hosts:<br>
>    compute1:<br>
>      ip: 192.168.100.12<br>
>      host_vars:<br>
>        nova_reserved_host_memory_mb: 256<br>
>    compute2:<br>
>      ip: 192.168.100.10<br>
><br>
> In this case you would have compute1 with reserved_host_memory_mb = 256 and<br>
> compute2 with the default value set for nova_reserved_host_memory_mb.<br>
><br>
><br>
> Flávio<br>
<br>
</span>Oh, I didn't see those variables, good hint! I'll give it a try, maybe<br>
that's good enough for me. Thanks a lot Flavio!<br>
<br>
<a href="http://git.openstack.org/cgit/openstack/openstack-ansible-os_nova/tree/templates/nova.conf.j2" rel="noreferrer" target="_blank">http://git.openstack.org/cgit/<wbr>openstack/openstack-ansible-os<wbr>_nova/tree/templates/nova.conf<wbr>.j2</a><br>
<br>
Despite that this will probably work, is that an "interface" I'm allowed<br>
to touch or is it considered an "internal/private" part of<br>
OpenStack-Ansible (and/or its roles)?<br>
<div class="m_2635810021118811941HOEnZb"><div class="m_2635810021118811941h5"><br>
--<br>
Regards, Markus Zoeller (markus_z)<br>
<br>
<br>
> 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>><br>
> wrote:<br>
><br>
>> 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=$<wbr>VALUE<br>
>>>><br>
>>>> My goal is this:<br>
>>>><br>
>>>>              | reserved_host_memory_mb<br>
>>>>     -----------------------------<wbr>-----<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_var<wbr>iables.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/openstac<wbr>k_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/openstac<wbr>k_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/openstac<wbr>k_user_config.yml --------<br>
>>>>     # [...]<br>
>>>>     # nova hypervisors<br>
>>>>     compute_hosts:<br>
>>>>     {% for host in groups['computes'] %}<br>
>>>>       {{ hostvars[host]['inventory_host<wbr>name'] }}:<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>
______________________________<wbr>______________________________<wbr>______________<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.op<wbr>enstack.org?subject:unsubscrib<wbr>e</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k-dev</a><br>
</div></div></blockquote></div><br></div></div>