-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor distro detection #645
Conversation
816fd8b
to
24eb966
Compare
PR is now rebased on the latest debiancentos commits. Note that the change from If you think |
Use new seapath_distro fact, added in [1], instead of ansible_distribution fact. [1]: seapath/ansible#645 Signed-off-by: Elinor Montmasson <[email protected]>
Can you create the meta/main.yml file in this new role so that it's uploadable to galaxy? thx. |
24eb966
to
bee5516
Compare
@insatomcat Thanks, done |
bee5516
to
900a3a6
Compare
Hi @insatomcat ! Have you got some comments on that ? Thanks |
900a3a6
to
c0059dd
Compare
Add role to detect which Seapath distribution each host is running. It will set a "seapath_distro" fact that can then be used in subsequent plays for conditional behaviour depending on the distro. Signed-off-by: Elinor Montmasson <[email protected]>
Use the new detect_seapath_distro role to detect the Seapath distribution and conditionally execute distro specific tasks. This replaces the use of the ansible_distribution fact. This fact cannot be used with Yocto Seapath as it depends on the DISTRO_NAME configured during build. This new role sets a seapath_distro fact to use by playbooks and roles. * Replace the use of ansible_distribution in roles by seapath_distro. Also add detect_seapath_distro as requirement for these roles to make sure seapath_distro is always set. * Call the detect_seapath_distro role and use seapath_distro in playbooks needing it. * Rename "Seapath_host_Yocto_distribution.yml" vars files to "Yocto.yml" to match and use seapath_distro. * Modify the ceph-ansible patches to use detect_seapath_distro. Signed-off-by: Elinor Montmasson <[email protected]>
c0059dd
to
b82f483
Compare
The ansible fact
ansible_distribution
work fine to detect if a Seapath distribution is Debian or CentOS, but doesn't work well for Yocto Seapath.With Yocto,
ansible_distribution
will be set to the value of DISTRO_NAME. As it is usual to have multiple distro configurations in a Yocto project, with different DISTRO_NAME values,ansible_distribution
wouldn't have a deterministic value for every Yocto Seapath build.With yocto scarthgap, the
/etc/os-release
file has a field CPE_NAME which will always contains "openembedded".It can then be used as a reliable way to detect a Yocto Seapath distribution.
This PR propose a new role, detect_seapath_distro, that will set a fact
seapath_distro
with a value of either Yocto, Debian or CentOS. To detect the correct distro, is usesansible_distribution*
facts and the /etc/os-release file.The new fact is then used everywhere a task needs to know the seapath distribution of the host.