osism / container-image-kolla-ansible

Container image which contains Ansible playbooks for deployment of OpenStack
https://www.osism.tech
Apache License 2.0
4 stars 6 forks source link

make default group configurable and set it to generic #693

Closed scoopex closed 1 month ago

scoopex commented 1 month ago

Since we want to configure the basic configuration of the switches automatically via Ansible (the things that don't make sense via the Sonic Management Framework), I have also added them in dedicated groups in our inventory.

In doing so, I noticed the following: As soon as these are defined in any group, they become part of the “all” group and Kolla Ansible tries to configure the switches like Openstack systems with osism apply common.

This makes little sense for switches, and it is possible that it could have unwanted effects on systems other than Kolla Ansible (Ceph, Managers, Monitoring).

It seems that the plays in container-image-kolla-ansible are [wired to “all”](see https://github.com/search?q=repo%3Aosism%2Fcontainer-image-kolla-ansible%20%22hosts%3A%20all%22&type=code).

I have now automated the process in changing this:

cd container-image-kolla-ansible
git grep -P “hosts: all”|cut -d “:” -f1 |sort -u|xargs sed -i “~s,hosts: all,hosts: {{ hosts_default_group|default(‘generic’) }},”

Does that make sense, or have I overlooked something? Would it perhaps make sense to define a hosts_kolla_group (with default "generic" ) instead of hosts_default_group?

artificial-intelligence commented 1 month ago

The thing is, this is currently not a supported setup as per the docs, see:

https://osism.tech/docs/guides/configuration-guide/inventory#define-variable-for-all-nodes

quote:

The Ansible group all is specifically used internally by OSISM, is reserved and is not supported for additional variables. When variables are added in the configuration repository for the all group, they are ignored. In OSISM the group generic can be used to store variables for all nodes.

So I'm not 100% sure what you are trying to achieve here, with replacing the all group with the generic group?

If you try to configure switches I would do so with dedicated roles and playbooks for those and not include those directly in the osism framework, which has it's purpose in deploying openstack (and some related services).

You can write e.g. a wrapper playbook yourself, which calls into osism where it makes sense and possibly include roles, vars or complete playbooks if you want.

At least in the current design it's not really feasible or supported to extend this to very different hosts like switches.

I don't know if we are open to change this @berendt ?

scoopex commented 1 month ago

The point is not to define variables in the “all” group, but that the “all” group is used in the Kolla-Ansible and Openstack playbooks (e.g. “common”) to identify the hosts for the execution of the tasks contained.

For this reason, osism apply common, for example, is then also rolled out on the switches (because they are in the “network_switches” group and their hosts have been automatically added to the “all” group).