[openstack-ansible] overriding host vars for compute_hosts
Hey folks, Unfortunately, I am not able to specify host specific variables for the compute hosts. I am trying to specify the `nova_user_ssl_*` variables for each compute node. When these variables are specified in `user_variables.yml` and then specified in `openstack_user_config.yml`, they don't actually end up overriding the variables. But they are recognised correctly in `openstack_inventory.json`. When I remove the variables from `user_variables.yml`, everything works correctly. Is it not possible to specify general variables in `user_variables.yml` and then overwrite them in `openstack_user_config.yml`? Example for `openstack_user_config.yml` (same Problem when using `host_vars` instead of `container_vars`): ``` compute_hosts: compute1: ip: 192.168.1.2 container_vars: nova_user_ssl_cert: "/path/to/cert1" nova_user_ssl_key: "/path/to/key1" nova_user_ssl_ca_cert: "/path/to/ca1" ``` thanks Roby
Hi, Really sorry for the late reply - I've just realized that answer was never sent but it is in my Drafts folder :( user_variables.yml has the highest precedence and overrides everything else. So what you should do - is leverage group_vars and host_vars inside /etc/openstack_deploy folder. So you can create a file like /etc/openstack_deploy/group_vars/nova_compute and put "generic" for all computes content in this file instead of user_variables. And then you can have /etc/openstack_deploy/host_vars/compute1 and place a specific for this host. Another thing you can do - is to create custom groups, like in example in the documentation: https://docs.openstack.org/openstack-ansible/latest/reference/inventory/conf... Hope that helps:) вт, 21 нояб. 2023 г. в 15:26, <pi3.14@tuta.io>:
Hey folks,
Unfortunately, I am not able to specify host specific variables for the compute hosts. I am trying to specify the `nova_user_ssl_*` variables for each compute node. When these variables are specified in `user_variables.yml` and then specified in `openstack_user_config.yml`, they don't actually end up overriding the variables. But they are recognised correctly in `openstack_inventory.json`. When I remove the variables from `user_variables.yml`, everything works correctly.
Is it not possible to specify general variables in `user_variables.yml` and then overwrite them in `openstack_user_config.yml`?
Example for `openstack_user_config.yml` (same Problem when using `host_vars` instead of `container_vars`):
``` compute_hosts: compute1: ip: 192.168.1.2 container_vars: nova_user_ssl_cert: "/path/to/cert1" nova_user_ssl_key: "/path/to/key1" nova_user_ssl_ca_cert: "/path/to/ca1" ```
thanks Roby
participants (2)
-
Dmitriy Rabotyagov
-
pi3.14@tuta.io