]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
share/ansible: implement distribution selection
authorIker Pedrosa <ipedrosa@redhat.com>
Wed, 29 May 2024 13:55:13 +0000 (15:55 +0200)
committerSerge Hallyn <serge@hallyn.com>
Thu, 18 Jul 2024 15:17:29 +0000 (10:17 -0500)
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>
share/ansible/playbook.yml
share/ansible/roles/build_container/tasks/main.yml
share/ansible/roles/ci_run/tasks/main.yml

index 95a4cb887a727da00cbf0c3a577a8465c57629cc..6e69e2e19c661ab4ce929bcfaf858928c9a7088e 100644 (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
index f7d3dbc565272fb8c0ceeac1bd2a10cecb17e419..c9a14f07e25e3cc6a89994133dbd620ca8b93ffd 100644 (file)
@@ -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
index 49d7b72a50e8f28858bfbcfb3a1f2d2be13d1707..209c2ab0218cb4a358b784780a0bd5660d69634b 100644 (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'