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 download directory
14 path: "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
18 - name: Create the directories for mixins
23 loop: "{{ directories | flatten | unique | map('regex_replace', '^', openwrt_imgbuilder_files) | list }}"
27 - "{{ openwrt_mixin | map('dirname') | list }}"
28 - "{{ openwrt_mixin | openwrt_mixin_type('directory') | map(attribute='key') | list }}"
30 - name: Create symlinks
32 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
33 src: "{{ item.value.link }}"
37 loop: "{{ openwrt_mixin | openwrt_mixin_type('link') }}"
39 label: "{{ item.key }}"
41 - name: Copy mixins in place (from file)
43 src: "{{ item.value.file }}"
44 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
45 mode: "{{ item.value.mode | default('0644') }}"
46 loop: "{{ openwrt_mixin | openwrt_mixin_type('file') }}"
48 label: "{{ item.key }}"
50 - name: Copy mixins in place (from content)
52 content: "{{ item.value.content }}"
53 dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
54 mode: "{{ item.value.mode | default('0644') }}"
55 loop: "{{ openwrt_mixin | openwrt_mixin_type('content') }}"
57 label: "{{ item.key }}"
59 - name: Generate /etc/fstab
61 fstab: "{{ openwrt_imgbuilder_files }}/etc/fstab"
63 src: "{{ item.src | default(omit) }}"
64 path: "{{ item.path | default(omit) }}"
65 fstype: "{{ item.fstype | default(omit) }}"
66 opts: "{{ item.opts | default(omit) }}"
67 boot: "{{ item.boot | default(omit) }}"
68 dump: "{{ item.dump | default(omit) }}"
69 passno: "{{ item.passno | default(omit) }}"
70 when: openwrt_mounts is defined
71 with_items: "{{ openwrt_mounts }}"
73 label: "{{ item.path }}"
76 - name: Create UCI configuration files
79 dest: "{{ openwrt_imgbuilder_files }}/etc/config/{{ item.key }}"
82 # force: no ## TODO: fail when overwriting a file
83 with_dict: "{{ openwrt_uci }}"
85 label: "{{ item.key }}"
87 - name: Create /etc/passwd
90 dest: "{{ openwrt_imgbuilder_files }}/etc/passwd"
93 when: openwrt_users is defined
95 - name: Create /etc/group
98 dest: "{{ openwrt_imgbuilder_files }}/etc/group"
101 when: openwrt_groups is defined or openwrt_users is defined
103 - name: extract image builder tarball
106 src: "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
107 dest: "{{ openwrt_imgbuilder_dir }}"
109 - name: Symlink the cache repository
112 src: "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
113 path: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/dl"