csmart / ansible-role-virt-infra

Define and manage guests and networks on a KVM host with Ansible
GNU General Public License v3.0
67 stars 48 forks source link

loading of distro vars overrides host vars #43

Open csmart opened 3 years ago

csmart commented 3 years ago

Loading distro specific vars, e.g. vars/centos.yml overrides any existing vars that have been set on the command line or as a part of the host inventory. For example, virt_infra_security_driver. Ideally these should only be loaded if a hostvar doesn't exist.

csmart commented 3 years ago

Maybe I should rename the distro defaults with _default in the name and only use it when the user hasn't defined it without _default e.g.

Default in distro:

---
virt_infra_default_security_driver: selinux

User sets inventory:

---
virt_infra_security_driver: none

Code does:

"{{ virt_infra_security_driver |default(virt_infra_default_security_driver) }}"