[jenkins-ci PATCH v2 4/5] ansible: Use ansible_distribution_release on FreeBSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In general, we can rely on ansible_distribution_major_version for a
quick way to figure out the OS version; however, when it comes to
FreeBSD's -CURRENT snapshots, that variable is not available, which
causes the playbook to fail.

Work around the problem by always extracting the OS version from
ansible_distribution_release, which is available even on -CURRENT.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 guests/tasks/base.yml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 1604cd0..8d7ff44 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -4,6 +4,7 @@
     os_name: '{{ ansible_distribution }}'
     os_version: '{{ ansible_distribution_major_version }}'
   when:
+    - ansible_distribution != 'FreeBSD'
     - ansible_distribution_release != 'Rawhide'
 
 - name: Set additional facts (OS)
@@ -11,8 +12,16 @@
     os_name: '{{ ansible_distribution }}'
     os_version: Rawhide
   when:
+    - ansible_distribution != 'FreeBSD'
     - ansible_distribution_release == 'Rawhide'
 
+- name: Set additional facts (OS)
+  set_fact:
+    os_name: '{{ ansible_distribution }}'
+    os_version: '{{ ansible_distribution_release|regex_replace("^(\d+)\.\d+-.*$", "\1") }}'
+  when:
+    - ansible_distribution == 'FreeBSD'
+
 - name: Set additional facts (package format)
   set_fact:
     package_format: deb
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux