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(a)redhat.com>
---
guests/tasks/base.yml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index abfd6a1..64fbabd 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