2 - name: Create temporary build directory
8 openwrt_imgbuilder_dir: "{{ tmpdir.path }}"
9 openwrt_imgbuilder_files: "{{ tmpdir.path }}/files"
11 - name: Create the directories for mixins
17 - "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
18 - "{{ openwrt_imgbuilder_files }}/etc/config"
19 - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
22 - name: Copy mixins in place [1/3]
24 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
25 src: "{{ item.value.link }}"
29 with_dict: "{{ openwrt_mixin }}"
30 when: '"link" in item.value'
32 label: "{{ item.key }}"
34 - name: Copy mixins in place [2/3]
36 src: "{{ item.value.file }}"
37 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
38 mode: "{{ item.value.mode | default('0644') }}"
39 with_dict: "{{ openwrt_mixin }}"
40 when: '"file" in item.value'
42 label: "{{ item.key }}"
44 - name: Copy mixins in place [3/3]
46 content: "{{ item.value.content }}"
47 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
48 mode: "{{ item.value.mode | default('0644') }}"
49 with_dict: "{{ openwrt_mixin }}"
50 when: '"content" in item.value'
52 label: "{{ item.key }}"
54 - name: Generate /etc/fstab
56 fstab: "{{ openwrt_imgbuilder_files }}/etc/fstab"
58 src: "{{ item.src | default(omit) }}"
59 path: "{{ item.path | default(omit) }}"
60 fstype: "{{ item.fstype | default(omit) }}"
61 opts: "{{ item.opts | default(omit) }}"
62 boot: "{{ item.boot | default(omit) }}"
63 dump: "{{ item.dump | default(omit) }}"
64 passno: "{{ item.passno | default(omit) }}"
65 when: openwrt_mounts is defined
66 with_items: "{{ openwrt_mounts }}"
68 label: "{{ item.path }}"
71 - name: Create UCI configuration files
74 dest: "{{ openwrt_imgbuilder_files }}/etc/config/{{ item.key }}"
77 # force: no ## TODO: fail when overwriting a file
78 with_dict: "{{ openwrt_uci }}"
80 label: "{{ item.key }}"
82 - name: Create /etc/passwd
85 dest: "{{ openwrt_imgbuilder_files }}/etc/passwd"
88 when: openwrt_users is defined
90 - name: Create /etc/group
93 dest: "{{ openwrt_imgbuilder_files }}/etc/group"
96 when: openwrt_groups is defined or openwrt_users is defined
100 src: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
101 dest: "{{ openwrt_imgbuilder_dir }}"
103 - name: Symlink the cache repository
106 src: "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
107 path: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/dl"