2 - name: Create temporary build directory
7 - name: set variables needed to build images
9 openwrt_imgbuilder_dir: "{{ tmpdir.path }}"
10 openwrt_imgbuilder_files: "{{ tmpdir.path }}/files"
12 - name: Create the directories for mixins
18 - "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
19 - "{{ openwrt_imgbuilder_files }}/etc/config"
20 - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
23 - name: Copy mixins in place [1/3]
25 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
26 src: "{{ item.value.link }}"
30 with_dict: "{{ openwrt_mixin }}"
31 when: '"link" in item.value'
33 label: "{{ item.key }}"
35 - name: Copy mixins in place [2/3]
37 src: "{{ item.value.file }}"
38 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
39 mode: "{{ item.value.mode | default('0644') }}"
40 with_dict: "{{ openwrt_mixin }}"
41 when: '"file" in item.value'
43 label: "{{ item.key }}"
45 - name: Copy mixins in place [3/3]
47 content: "{{ item.value.content }}"
48 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
49 mode: "{{ item.value.mode | default('0644') }}"
50 with_dict: "{{ openwrt_mixin }}"
51 when: '"content" in item.value'
53 label: "{{ item.key }}"
55 - name: Generate /etc/fstab
57 fstab: "{{ openwrt_imgbuilder_files }}/etc/fstab"
59 src: "{{ item.src | default(omit) }}"
60 path: "{{ item.path | default(omit) }}"
61 fstype: "{{ item.fstype | default(omit) }}"
62 opts: "{{ item.opts | default(omit) }}"
63 boot: "{{ item.boot | default(omit) }}"
64 dump: "{{ item.dump | default(omit) }}"
65 passno: "{{ item.passno | default(omit) }}"
66 when: openwrt_mounts is defined
67 with_items: "{{ openwrt_mounts }}"
69 label: "{{ item.path }}"
72 - name: Create UCI configuration files
75 dest: "{{ openwrt_imgbuilder_files }}/etc/config/{{ item.key }}"
78 # force: no ## TODO: fail when overwriting a file
79 with_dict: "{{ openwrt_uci }}"
81 label: "{{ item.key }}"
83 - name: Create /etc/passwd
86 dest: "{{ openwrt_imgbuilder_files }}/etc/passwd"
89 when: openwrt_users is defined
91 - name: Create /etc/group
94 dest: "{{ openwrt_imgbuilder_files }}/etc/group"
97 when: openwrt_groups is defined or openwrt_users is defined
99 - name: extract image builder tarball
102 src: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
103 dest: "{{ openwrt_imgbuilder_dir }}"
105 - name: Symlink the cache repository
108 src: "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
109 path: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/dl"