2 - name: Create temporary build directory
3 command: mktemp --tmpdir -d openwrt-{{ inventory_hostname }}.XXXXXX
7 openwrt_imgbuilder_dir: "{{ tmpdir.stdout }}"
8 openwrt_imgbuilder_files: "{{ tmpdir.stdout }}/files"
10 - name: Create the directories for mixins
16 - "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
17 - "{{ openwrt_imgbuilder_files }}/etc/config"
18 - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
21 - name: Copy mixins in place [1/2]
23 src: "{{ item.value.file }}"
24 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
25 mode: "{{ item.value.mode | default('0644') }}"
26 with_dict: "{{ openwrt_mixin }}"
27 when: '"file" in item.value'
29 label: "{{ item.key }}"
31 - name: Copy mixins in place [2/2]
33 content: "{{ item.value.content }}"
34 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
35 mode: "{{ item.value.mode | default('0644') }}"
36 with_dict: "{{ openwrt_mixin }}"
37 when: '"content" in item.value'
39 label: "{{ item.key }}"
41 - name: Generate /etc/fstab
43 fstab: "{{ openwrt_imgbuilder_files }}/etc/fstab"
45 src: "{{ item.src | default(omit) }}"
46 path: "{{ item.path | default(omit) }}"
47 fstype: "{{ item.fstype | default(omit) }}"
48 opts: "{{ item.opts | default(omit) }}"
49 boot: "{{ item.boot | default(omit) }}"
50 dump: "{{ item.dump | default(omit) }}"
51 passno: "{{ item.passno | default(omit) }}"
52 when: openwrt_mounts is defined
53 with_items: "{{ openwrt_mounts }}"
55 label: "{{ item.path }}"
58 - name: Create UCI configuration files
61 dest: "{{ openwrt_imgbuilder_files }}/etc/config/{{ item.key }}"
64 # force: no ## TODO: fail when overwriting a file
65 with_dict: "{{ openwrt_uci }}"
67 label: "{{ item.key }}"
69 - name: Create /etc/passwd
72 dest: "{{ openwrt_imgbuilder_files }}/etc/passwd"
75 when: openwrt_users is defined
77 - name: Create /etc/group
80 dest: "{{ openwrt_imgbuilder_files }}/etc/group"
83 when: openwrt_groups is defined or openwrt_users is defined
87 src: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
88 dest: "{{ openwrt_imgbuilder_dir }}"
90 - name: Symlink the cache repository
93 src: "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
94 path: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/dl"