We currently know about three development branches: Fedora
Rawhide, Debian sid and FreeBSD -CURRENT.
For all three, we use the name of the development branch in
the guest name; however, the value of os_version is not set
consistently, making it awkward to create package mappings
specific to these development branches.
As an added bonus, this makes the code setting os_name and
os_version more straightforward by simplifying conditionals
and removing regexp-based string replacement.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
guests/tasks/base.yml | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/guests/tasks/base.yml b/guests/tasks/base.yml
index 70d5abc..9f27470 100644
--- a/guests/tasks/base.yml
+++ b/guests/tasks/base.yml
@@ -2,25 +2,33 @@
- name: Set additional facts (OS)
set_fact:
os_name: '{{ ansible_distribution }}'
+
+- name: Set additional facts (OS)
+ set_fact:
os_version: '{{ ansible_distribution_major_version }}'
when:
- - ansible_distribution != 'FreeBSD'
- - ansible_distribution_release != 'Rawhide'
+ - ansible_distribution_major_version is defined
- name: Set additional facts (OS)
set_fact:
- os_name: '{{ ansible_distribution }}'
os_version: Rawhide
when:
- - ansible_distribution != 'FreeBSD'
+ - os_name == 'Fedora'
- 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")
}}'
+ os_version: Sid
+ when:
+ - os_name == 'Debian'
+ - '{{ ansible_distribution_major_version|match("^.*/sid$") }}'
+
+- name: Set additional facts (OS)
+ set_fact:
+ os_version: Current
when:
- ansible_distribution == 'FreeBSD'
+ - '{{ ansible_distribution_release|match("^.*-CURRENT$") }}'
- name: Set additional facts (package format)
set_fact:
--
2.17.0