share/ansible: implement distribution selection

Distribution to run can be selected when running `ansible-playbook` by
appending `-e 'distribution=fedora'` to the command.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
This commit is contained in:
Iker Pedrosa
2024-07-18 10:17:29 -05:00
committed by Serge Hallyn
parent 80c4e70da0
commit d8fb10f7b7
3 changed files with 9 additions and 9 deletions
+6 -2
View File
@@ -1,9 +1,13 @@
- name: Start build container
hosts: localhost
vars:
image:
fedora: registry.fedoraproject.org/fedora:latest
alpine: docker.io/library/alpine:latest
debian: docker.io/library/debian:latest
roles:
- role: build_container
vars:
container_image: registry.fedoraproject.org/fedora:latest
- name: CI run
hosts: builder
@@ -2,13 +2,13 @@
# tasks file for build_container
- name: Pull container image
containers.podman.podman_image:
name: '{{ container_image }}'
name: '{{ image[distribution] }}'
- name: Create and start container
containers.podman.podman_container:
name: builder
state: started
image: '{{ container_image }}'
image: '{{ image[distribution] }}'
command: "sleep 1d"
- name: Create repo
+1 -5
View File
@@ -1,8 +1,4 @@
---
# tasks file for ci_run
- name: 'Include distribution specific ci_run tasks fedora'
include_tasks: '{{ include_file }}'
loop_control:
loop_var: include_file
with_first_found:
- files: fedora.yml
include_tasks: '{{ distribution }}.yml'