Ajout du support de pfSense.
authorProgfou <jean-christophe.andre@auf.org>
Wed, 9 Mar 2016 20:36:44 +0000 (15:36 -0500)
committerProgfou <jean-christophe.andre@auf.org>
Wed, 9 Mar 2016 20:36:44 +0000 (15:36 -0500)
scripts/ansible-debian-versions

index 462525a..80fd503 100755 (executable)
@@ -9,6 +9,7 @@ Auteur : Progfou <jean-christophe.andre@auf.org>
 import sys
 import ansible.runner
 from time import strftime
+import re
 
 if len(sys.argv) != 2:
     print "Usage : %s <nom-d-ensemble-de-machines>" % sys.argv[0]
@@ -43,9 +44,15 @@ for server,data in out['contacted'].items():
     data['name'] = server
     facts = data['ansible_facts']
     if 'ansible_lsb' in facts:
-        lsb_data = data['ansible_facts']['ansible_lsb']
+        lsb_data = facts['ansible_lsb']
         data['description'] = lsb_data['description']
         data['major_release'] = lsb_data['major_release']
+    elif 'ansible_distribution' in facts and 'ansible_distribution_release' in facts:
+        data['description'] = "%s %s" % (facts['ansible_distribution'],
+                                    facts['ansible_distribution_release'])
+        data['major_release'] = re.split(r'[^0-9]', facts['ansible_distribution_release'])[0]
+        if not data['major_release']:
+            data['major_release'] = '0'
     else:
         data['description'] = 'inconnue (information non disponible)'
         data['major_release'] = '0'
@@ -60,6 +67,8 @@ for server,data in out['contacted'].items():
         virtual_info = virtual_info.replace('host', 'hôte')
         virtual_info = virtual_info.replace('guest', 'invité')
         data['virtual_info'] = virtual_info
+    elif 'ansible_processor' in facts and facts['ansible_processor'][0].startswith('QEMU'):
+        data['virtual_info'] = "'''QEMU'''"
     else:
         data['virtual_info'] = 'inconnu'
     if 'ansible_machine' in facts and 'ansible_userspace_bits' in facts: