ansible-collection-uffd/roles/build/tasks/main.yml
Nis Wechselberg 29d7b1c504
First version of the uffd collection
Signed-off-by: Nis Wechselberg <enbewe@enbewe.de>
2024-12-20 17:38:05 +01:00

74 lines
1.8 KiB
YAML

---
- name: 'Install required software'
become: true
ansible.builtin.apt:
name: 'podman'
state: 'present'
# Build image to run uffd in
- name: 'Create temporary build directory'
become: true
ansible.builtin.file:
path: '{{ uffd_build_tempdir }}'
state: 'directory'
mode: 'u=rwx,g=rx,o=rx'
- name: 'Copy static files for image'
become: true
ansible.builtin.copy:
src: '{{ item.file }}'
dest: '{{ uffd_build_tempdir }}/{{ item.file }}'
owner: 'root'
group: 'root'
mode: '{{ item.mode }}'
loop:
- file: 'cccv-archive-key.asc'
mode: 'u=rw,g=r,o=r'
- file: 'entrypoint.sh'
mode: 'u=rwx,g=rx,o=rx'
- file: 'uffd_2.3.1+git20241021T122809-98fe5690_all.deb'
mode: 'u=rw,g=r,o=r'
- name: 'Copy templates for image'
become: true
ansible.builtin.template:
src: '{{ item.file }}'
dest: '{{ uffd_build_tempdir }}/{{ item.file }}'
owner: 'root'
group: 'root'
mode: '{{ item.mode }}'
loop:
- file: 'cccv-archive.list'
mode: 'u=rw,g=r,o=r'
- file: 'Containerfile'
mode: 'u=rw,g=r,o=r'
- name: 'Create recent uffd image'
become: true
containers.podman.podman_image:
build:
cache: false
force_rm: true
rm: true
pull: false
push: false
force: '{{ uffd_build_force_rebuild }}'
name: 'uffd'
path: '{{ uffd_build_tempdir }}'
tag: '{{ ansible_date_time.iso8601_basic_short }}'
register: 'created_image_data'
- name: 'Tag image as latest'
when: '{{ uffd_build_tag_latest }}'
become: true
containers.podman.podman_tag:
image: '{{ created_image_data.image[0].NamesHistory[0] }}'
target_names:
- 'uffd:latest'
register: 'created_image_data'
- name: 'Cleanup temporary build directory'
become: true
ansible.builtin.file:
state: 'absent'
path: '{{ uffd_build_tempdir }}'