add more flexible versioning logic

This commit is contained in:
ace 2024-01-04 13:54:34 +03:00
parent 255166ae26
commit 3caa5a2049
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
4 changed files with 16 additions and 4 deletions

View File

@ -1,2 +1,2 @@
---
podman_version: "{{ '1.6.4' if ansible_facts['distribution_major_version'] == '7' else '4.4.1' if ansible_facts['distribution_major_version'] == '8' else '4.4.1' if ansible_facts['distribution_major_version'] == '9' }}"
podman_version: ""

View File

@ -1,5 +1,5 @@
---
- name: Ensure podman version {{ podman_version }} installed
- name: Ensure {{ podman_package }} installed
yum:
name: "podman-{{ podman_version }}"
state: present
name: "{{ podman_package }}"
state: "{{ 'latest' if podman_version == 'latest' else 'present' }}"

View File

@ -1,3 +1,13 @@
---
- name: Load a variable file based on the OS type
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- "{{ ansible_facts['distribution'] }}.yaml"
- "{{ ansible_facts['os_family'] }}.yaml"
paths:
- "vars"
- name: Include podman install
include_tasks: "{{ ansible_facts['os_family'] }}.yaml"

2
vars/RedHat.yaml Normal file
View File

@ -0,0 +1,2 @@
podman_package_name: podman
podman_package: "{{ podman_package_name + '-' + podman_version if (podman_version is defined and (podman_version != '*' and podman_version != '' and podman_version != 'latest')) else podman_package_name }}"