blob: 284b24a4d967d9f9febccb95777939cd8f325e0b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
---
- name: fetch base image
run_once: true
import_tasks: fetch.yml
- name: build the image
block:
- name: create the output directory for built images
file:
path: "{{ raspios_output_dir }}"
state: directory
- name: Create temporary build directory
tempfile:
state: directory
register: tmpdir
- name: build the raspios image
command: >-
bash -c "cp '{{ raspios_download_dir }}/{{ raspios_download_image_base_name }}.zip' '{{ tmpdir.path }}/output.zip'; echo 'TODO: extract image...'"
register: raspios_build
- name: copy newly built raspios image
copy:
src: "{{ tmpdir.path }}/output.zip"
dest: "{{ raspios_output_dir }}/{{ raspios_output_image_base_name }}.zip"
- name: set output image names
set_fact:
output_images:
- "{{ raspios_output_dir }}/{{ raspios_output_image_base_name }}.zip"
always:
- name: save stdout build-log to output directory
when: raspios_build is defined
copy:
content: "{{ raspios_build.stdout }}\n"
dest: "{{ raspios_output_dir }}/build-stdout.log"
- name: save stderr build-log to output directory
when: raspios_build is defined
copy:
content: "{{ raspios_build.stderr }}\n"
dest: "{{ raspios_output_dir }}/build-stderr.log"
- name: delete the temporary build directory
when: not raspios_keep_temporary_build_dir
file:
path: "{{ tmpdir.path }}"
state: absent
- name: print temporary build directory information
when: raspios_keep_temporary_build_dir
debug:
msg: "The temporary build directory has not been deleted, the path to the directory is: {{ tmpdir.path }}"
|