Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
On 23.08.2017 00:16, Jean-Philippe Evrard wrote: > Hello, > > 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. > > We've been slowly phasing out variables insides templates, to exclusively > rely on config_template overrides (See also: [1] and [2]) > Please note that if a variable is deprecated, we are issuing a release note. > > [1]: https://github.com/openstack/openstack-ansible-os_nova/blob/ > 4b9100a612ba0e9449d792b2783b9ec50a8fb28e/tasks/nova_post_install.yml#L40 > [2]: https://docs.openstack.org/project-deploy-guide/ > openstack-ansible/ocata/app-advanced-config-override.html > > Best regards, > JP That helps resolving my issues. Thanks a lot! -- Regards, Markus Zoeller (markus_z) > > On Tue, Aug 22, 2017 at 1:24 PM, Markus Zoeller> wrote: > >> On 22.08.2017 09:46, Flávio Ramalho wrote: >>> Hi Markus, >>> >>> I think you can achieve what you want by simple overriding the host >>> variables, for example: >>> >>> In /etc/openstack_deploy/openstack_user_config.yml: >>> compute_hosts: >>>compute1: >>> ip: 192.168.100.12 >>> host_vars: >>>nova_reserved_host_memory_mb: 256 >>>compute2: >>> ip: 192.168.100.10 >>> >>> In this case you would have compute1 with reserved_host_memory_mb = 256 >> and >>> compute2 with the default value set for nova_reserved_host_memory_mb. >>> >>> >>> Flávio >> >> Oh, I didn't see those variables, good hint! I'll give it a try, maybe >> that's good enough for me. Thanks a lot Flavio! >> >> http://git.openstack.org/cgit/openstack/openstack-ansible-os >> _nova/tree/templates/nova.conf.j2 >> >> Despite that this will probably work, is that an "interface" I'm allowed >> to touch or is it considered an "internal/private" part of >> OpenStack-Ansible (and/or its roles)? >> >> -- >> Regards, Markus Zoeller (markus_z) >> >> >>> On Mon, Aug 21, 2017 at 6:09 PM Markus Zoeller < >> mzoel...@linux.vnet.ibm.com> >>> wrote: >>> On 21.08.2017 16:40, Andy McCrae wrote: > 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. > Replacing `host_vars` with `container_vars` didn't have an effect: ### controller1: /etc/openstack_deploy/openstack_user_config.yml # nova hypervisors compute_hosts: compute1: ip: 192.168.100.12 container_vars: nova_nova_conf_overrides: DEFAULT: reserved_host_memory_mb: 256 compute2: ip: 192.168.100.10 Both compute nodes still have the same $VALUE, although `compute1` should have 256: ### compute1: /etc/nova/nova.conf root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf reserved_host_memory_mb = 512 ### compute2: /etc/nova/nova.conf root@compute2:~# grep reserved_host_memory_mb
Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
Hello, 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. We've been slowly phasing out variables insides templates, to exclusively rely on config_template overrides (See also: [1] and [2]) Please note that if a variable is deprecated, we are issuing a release note. [1]: https://github.com/openstack/openstack-ansible-os_nova/blob/ 4b9100a612ba0e9449d792b2783b9ec50a8fb28e/tasks/nova_post_install.yml#L40 [2]: https://docs.openstack.org/project-deploy-guide/ openstack-ansible/ocata/app-advanced-config-override.html Best regards, JP On Tue, Aug 22, 2017 at 1:24 PM, Markus Zoellerwrote: > On 22.08.2017 09:46, Flávio Ramalho wrote: > > Hi Markus, > > > > I think you can achieve what you want by simple overriding the host > > variables, for example: > > > > In /etc/openstack_deploy/openstack_user_config.yml: > > compute_hosts: > >compute1: > > ip: 192.168.100.12 > > host_vars: > >nova_reserved_host_memory_mb: 256 > >compute2: > > ip: 192.168.100.10 > > > > In this case you would have compute1 with reserved_host_memory_mb = 256 > and > > compute2 with the default value set for nova_reserved_host_memory_mb. > > > > > > Flávio > > Oh, I didn't see those variables, good hint! I'll give it a try, maybe > that's good enough for me. Thanks a lot Flavio! > > http://git.openstack.org/cgit/openstack/openstack-ansible-os > _nova/tree/templates/nova.conf.j2 > > Despite that this will probably work, is that an "interface" I'm allowed > to touch or is it considered an "internal/private" part of > OpenStack-Ansible (and/or its roles)? > > -- > Regards, Markus Zoeller (markus_z) > > > > On Mon, Aug 21, 2017 at 6:09 PM Markus Zoeller < > mzoel...@linux.vnet.ibm.com> > > wrote: > > > >> On 21.08.2017 16:40, Andy McCrae wrote: > >>> 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. > >>> > >> > >> > >> Replacing `host_vars` with `container_vars` didn't have an effect: > >> > >> ### controller1: /etc/openstack_deploy/openstack_user_config.yml > >> # nova hypervisors > >> compute_hosts: > >> compute1: > >> ip: 192.168.100.12 > >> container_vars: > >> nova_nova_conf_overrides: > >> DEFAULT: > >> reserved_host_memory_mb: 256 > >> compute2: > >> ip: 192.168.100.10 > >> > >> Both compute nodes still have the same $VALUE, although `compute1` > >> should have 256: > >> > >> ### compute1: /etc/nova/nova.conf > >> root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf > >> reserved_host_memory_mb = 512 > >> > >> > >> ### compute2: /etc/nova/nova.conf > >> root@compute2:~# grep reserved_host_memory_mb /etc/nova/nova.conf > >> reserved_host_memory_mb = 512 > >> > >> I'd like to avoid to introduce some "clever" dict merging algorithm I > >> won't understand anymore after a few weeks. :/ > >>
Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
On 22.08.2017 09:46, Flávio Ramalho wrote: > Hi Markus, > > I think you can achieve what you want by simple overriding the host > variables, for example: > > In /etc/openstack_deploy/openstack_user_config.yml: > compute_hosts: >compute1: > ip: 192.168.100.12 > host_vars: >nova_reserved_host_memory_mb: 256 >compute2: > ip: 192.168.100.10 > > In this case you would have compute1 with reserved_host_memory_mb = 256 and > compute2 with the default value set for nova_reserved_host_memory_mb. > > > Flávio Oh, I didn't see those variables, good hint! I'll give it a try, maybe that's good enough for me. Thanks a lot Flavio! http://git.openstack.org/cgit/openstack/openstack-ansible-os_nova/tree/templates/nova.conf.j2 Despite that this will probably work, is that an "interface" I'm allowed to touch or is it considered an "internal/private" part of OpenStack-Ansible (and/or its roles)? -- Regards, Markus Zoeller (markus_z) > On Mon, Aug 21, 2017 at 6:09 PM Markus Zoeller> wrote: > >> On 21.08.2017 16:40, Andy McCrae wrote: >>> 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. >>> >> >> >> Replacing `host_vars` with `container_vars` didn't have an effect: >> >> ### controller1: /etc/openstack_deploy/openstack_user_config.yml >> # nova hypervisors >> compute_hosts: >> compute1: >> ip: 192.168.100.12 >> container_vars: >> nova_nova_conf_overrides: >> DEFAULT: >> reserved_host_memory_mb: 256 >> compute2: >> ip: 192.168.100.10 >> >> Both compute nodes still have the same $VALUE, although `compute1` >> should have 256: >> >> ### compute1: /etc/nova/nova.conf >> root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf >> reserved_host_memory_mb = 512 >> >> >> ### compute2: /etc/nova/nova.conf >> root@compute2:~# grep reserved_host_memory_mb /etc/nova/nova.conf >> reserved_host_memory_mb = 512 >> >> I'd like to avoid to introduce some "clever" dict merging algorithm I >> won't understand anymore after a few weeks. :/ >> >> Any hint is appreciated! >> >> -- >> Regards, Markus Zoeller (markus_z) >> 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 >>> >>> __ OpenStack Development
Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
Hi Markus, I think you can achieve what you want by simple overriding the host variables, for example: In /etc/openstack_deploy/openstack_user_config.yml: compute_hosts: compute1: ip: 192.168.100.12 host_vars: nova_reserved_host_memory_mb: 256 compute2: ip: 192.168.100.10 In this case you would have compute1 with reserved_host_memory_mb = 256 and compute2 with the default value set for nova_reserved_host_memory_mb. Flávio On Mon, Aug 21, 2017 at 6:09 PM Markus Zoellerwrote: > On 21.08.2017 16:40, Andy McCrae wrote: > > 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. > > > > > Replacing `host_vars` with `container_vars` didn't have an effect: > > ### controller1: /etc/openstack_deploy/openstack_user_config.yml > # nova hypervisors > compute_hosts: > compute1: > ip: 192.168.100.12 > container_vars: > nova_nova_conf_overrides: > DEFAULT: > reserved_host_memory_mb: 256 > compute2: > ip: 192.168.100.10 > > Both compute nodes still have the same $VALUE, although `compute1` > should have 256: > > ### compute1: /etc/nova/nova.conf > root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf > reserved_host_memory_mb = 512 > > > ### compute2: /etc/nova/nova.conf > root@compute2:~# grep reserved_host_memory_mb /etc/nova/nova.conf > reserved_host_memory_mb = 512 > > I'd like to avoid to introduce some "clever" dict merging algorithm I > won't understand anymore after a few weeks. :/ > > Any hint is appreciated! > > -- > Regards, Markus Zoeller (markus_z) > > >> > >> 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 > > > > > > > > > __ > > OpenStack Development Mailing List (not for usage questions) > > Unsubscribe: > openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > > > > > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >
Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
On 21.08.2017 16:40, Andy McCrae wrote: > 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. > Replacing `host_vars` with `container_vars` didn't have an effect: ### controller1: /etc/openstack_deploy/openstack_user_config.yml # nova hypervisors compute_hosts: compute1: ip: 192.168.100.12 container_vars: nova_nova_conf_overrides: DEFAULT: reserved_host_memory_mb: 256 compute2: ip: 192.168.100.10 Both compute nodes still have the same $VALUE, although `compute1` should have 256: ### compute1: /etc/nova/nova.conf root@compute1:~# grep reserved_host_memory_mb /etc/nova/nova.conf reserved_host_memory_mb = 512 ### compute2: /etc/nova/nova.conf root@compute2:~# grep reserved_host_memory_mb /etc/nova/nova.conf reserved_host_memory_mb = 512 I'd like to avoid to introduce some "clever" dict merging algorithm I won't understand anymore after a few weeks. :/ Any hint is appreciated! -- Regards, Markus Zoeller (markus_z) >> >> 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 > > > > __ > OpenStack Development Mailing List (not for usage questions) > Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Re: [openstack-dev] [openstack-ansible] group/host specific config file overrides: how-to?
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 __ OpenStack Development Mailing List (not for usage questions) Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev