-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Hi folks,
currently I do manage all my systems with ansible and former puppet.
But no system that I tested had a version that detect devuan a clean
way.
I first started with distributing a /usr/share/distro-info/devuan.csv
with content of:
version,codename,series,created,release,eol
8,Jessie,jessie,2013-05-04,2015-04-25
9,Ascii,ascii,2015-04-25
,Ceres,ceres,1993-08-16
... but I think, that file should be included in distro-info-data.
But there is more. With current ansible I get the following
(distribution specific) facts on a debian sid:
"ansible_distribution": "Debian",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/os-release",
"ansible_distribution_file_variety": "Debian",
"ansible_distribution_major_version": "buster/sid",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "buster/sid",
"ansible_lsb": {
"codename": "sid",
"description": "Debian GNU/Linux unstable (sid)",
"id": "Debian",
"major_release": "unstable",
"release": "unstable"
},
"ansible_os_family": "Debian",
A devuan unstable gives me the following:
"ansible_distribution": "Devuan GNU/Linux",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/os-release",
"ansible_distribution_file_variety": "NA",
"ansible_distribution_major_version": "stretch/sid",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "stretch/sid",
"ansible_lsb": {
"codename": "ceres",
"description": "Devuan GNU/Linux unstable (ceres)",
"id": "Devuan",
"major_release": "unstable",
"release": "unstable"
},
"ansible_os_family": "Devuan GNU/Linux",
And a devuan stable gives me the following:
"ansible_distribution": "Debian",
"ansible_distribution_major_version": "8",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "8.7",
"ansible_lsb": {
"codename": "jessie",
"description": "Devuan GNU/Linux 1.0 (jessie)",
"id": "Devuan",
"major_release": "1",
"release": "1.0"
},
"ansible_os_family": "Debian",
That makes several problems.
First, for every system the ansible_os_family should be Debian as it is
for all .deb based distributions. And even worse, it should never be
something with space.
Next, the ansible_distribution* stuff should have some reasonable
values. First ansible_distribution sould be "Devuan",
ansible_distribution_file_variety should be "Debian",
ansible_distribution_major_version should be the numeric major or NA
(for unstable), ansible_distribution_release should be the name of the
distribution and ansible_distribution_version should be the version with
minor version.
I did some patching of
/usr/lib/python2.7/dist-packages/ansible/module_utils/facts/system/distribution.py
(see below) to get the following:
"ansible_distribution": "Devuan",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/os-release",
"ansible_distribution_file_variety": "Debian",
"ansible_distribution_major_version": "ascii/ceres",
"ansible_distribution_release": "ascii/ceres",
"ansible_distribution_version": "ascii/ceres",
"ansible_lsb": {
"codename": "ceres",
"description": "Devuan GNU/Linux unstable (ceres)",
"id": "Devuan",
"major_release": "unstable",
"release": "unstable"
},
"ansible_os_family": "Debian",
As I am a perl hacker and not a python hacker, the patch might be not
the best and there is many room for improvement:
--- distribution.py.orig 2017-12-10 15:11:55.389637887 +0100
+++ distribution.py 2017-12-10 15:36:22.463056530 +0100
@@ -310,6 +310,18 @@
rc, out, err = self.module.run_command(cmd)
if rc == 0:
debian_facts['distribution_release'] = out.strip()
+ elif 'Devuan' in data:
+ debian_facts['distribution'] = 'Devuan'
+ release1 = re.search("PRETTY_NAME=.* ([0-9]+) \(([^)]+)\)",
data)
+ release2 = re.search("PRETTY_NAME=.* ([^ \"]+)\"", data)
+ if release1:
+ debian_facts['distribution_release'] = release1.groups()[1]
+ debian_facts['distribution_major_version'] =
release1.groups()[0]
+ debian_facts['distribution_version'] = release1.groups()[0]
+ elif release2:
+ debian_facts['distribution_release'] = release2.groups()[0]
+ debian_facts['distribution_major_version'] =
release2.groups()[0]
+ debian_facts['distribution_version'] = release2.groups()[0]
elif 'Ubuntu' in data:
debian_facts['distribution'] = 'Ubuntu'
# nothing else to do, Ubuntu gets correct info from python
functions
@@ -411,7 +423,7 @@
'Ascendos', 'CloudLinux', 'PSBM',
'OracleLinux', 'OVS',
'OEL', 'Amazon', 'Virtuozzo', 'XenServer'],
'Debian': ['Debian', 'Ubuntu', 'Raspbian', 'Neon',
'KDE neon',
- 'Linux Mint'],
+ 'Linux Mint', 'Devuan'],
'Suse': ['SuSE', 'SLES', 'SLED', 'openSUSE', 'openSUSE
Tumbleweed',
'SLES_SAP', 'SUSE_LINUX', 'openSUSE Leap'],
'Archlinux': ['Archlinux', 'Antergos', 'Manjaro'],
Do you see a better way to do the stuff? Best would be to use the lsb
stuff but that is only available when lsb-release is installed.
Regards
Klaus
- --
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen <[email protected]>
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Comment: Charset: ISO-8859-1
iQGzBAEBCgAdFiEEMWF28vh4/UMJJLQEpnwKsYAZ9qwFAlotT4oACgkQpnwKsYAZ
9qytqQwAnwIaOrPDUygVPOBT3ntQbwLoDyi2848XjORbQtdAKQJ1RzDl5Potyd07
MuZOQMjU8S5GGwwR2NFA+fKEA1v6x3hwnE/WXL+tsvxt5qtjQ12h0oAfDon1tkj/
P/E++JPu0KB1Ci+f/QNr7u0nO8yAtnE18ReK/a7NRlCJYJKheJ6t/HCy7J3mLQxh
l2n4+Ytkt2RFzO3DwupT8W8u6x5VPCyq5LY+DBGVngoWPRksejjoMbC1plyOfoHx
jO/evv9H+Dvv/VjGDQu1RtmpikyJ2E/1KrHrsXjFL7XBrxzvk/2jqTknz6UFT184
fR3yH3uZMRdJPvO/e7o+PiwS3EuFYKdSfXgOE8AFNQVseThUj12LLDY1rnac3fmd
YGYbOvMldqc501xl1m5xY06CkkyeGNB/BXRsJeOI/gHX3ulyoK3Ec6BdKgNZjG/b
e//6Bi2dYX0TaarYvjzIHCeU9QlRV5Qbt7G02BUdENzT9JX5LDzS/Icwmo1jxaki
+aST6tEL
=auWh
-----END PGP SIGNATURE-----
_______________________________________________
Dng mailing list
[email protected]
https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng