50 lines
1.9 KiB
YAML
50 lines
1.9 KiB
YAML
---
|
|
- name: Load all quadlet app definitions
|
|
ansible.builtin.set_fact:
|
|
quadlets_apps: "{{ quadlets_apps | default([]) + [lookup('file', item.path) | from_yaml] }}"
|
|
loop: "{{ lookup('ansible.builtin.find', role_path, patterns='*.yml', excludes=['tasks']).files }}"
|
|
|
|
- name: Deploy app configs
|
|
ansible.builtin.template:
|
|
content: "{{ item.1.template }}"
|
|
dest: "{{ item.1.path }}"
|
|
mode: '0644'
|
|
loop: "{{ quadlets_apps | subelements('configs', skip_missing=True) }}"
|
|
when: item.1.template is defined
|
|
|
|
- name: Initialize quadlet specs
|
|
ansible.builtin.set_fact:
|
|
quadlets_all_specs: []
|
|
|
|
- name: Extract quadlet specs from app definitions
|
|
ansible.builtin.set_fact:
|
|
quadlets_all_specs: "{{ quadlets_all_specs + item.1 }}"
|
|
loop: "{{ quadlets_apps | subelements('quadlets', skip_missing=True) }}"
|
|
|
|
- name: Build final quadlet specs with pod injection
|
|
ansible.builtin.set_fact:
|
|
quadlets_specs: "{{ (pods | default([])) | map('combine', {'type': 'pod'}) | list }}"
|
|
|
|
- name: Add containers to quadlet specs with pod injection
|
|
ansible.builtin.set_fact:
|
|
quadlets_specs: "{{ quadlets_specs + [container_spec[0] | combine({'pod': item.0.name})] }}"
|
|
loop: "{{ pods | default([]) | subelements('containers') }}"
|
|
vars:
|
|
container_spec: "{{ quadlets_all_specs | selectattr('name', 'equalto', item.1) | selectattr('type', 'equalto', 'container') | list }}"
|
|
when: container_spec | length > 0
|
|
|
|
- name: Add build specs for enabled containers
|
|
ansible.builtin.set_fact:
|
|
quadlets_specs: "{{ quadlets_specs + [item] }}"
|
|
loop: "{{ quadlets_all_specs }}"
|
|
when:
|
|
- item.type == 'build'
|
|
- item.name in (pods | default([]) | map(attribute='containers') | flatten)
|
|
|
|
- name: Deploy quadlets using fedora.linux_system_roles.podman
|
|
ansible.builtin.include_role:
|
|
name: fedora.linux_system_roles.podman
|
|
vars:
|
|
podman_quadlet_specs: "{{ quadlets_specs }}"
|
|
when: quadlets_specs is defined and quadlets_specs | length > 0
|