Merge pull request #50 from realraum/ansible/openwrt-image-links
[noc.git] / ansible / roles / openwrt / image / tasks / prepare.yml
index 3414371..a3ab711 100644 (file)
@@ -4,7 +4,8 @@
     state: directory
   register: tmpdir
 
-- set_fact:
+- name: set variables needed to build images
+  set_fact:
     openwrt_imgbuilder_dir:   "{{ tmpdir.path }}"
     openwrt_imgbuilder_files: "{{ tmpdir.path }}/files"
 
     - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
 
 
-- name: Copy mixins in place [1/2]
+- name: Copy mixins in place [1/3]
+  file:
+    dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
+    src: "{{ item.value.link }}"
+    force: yes
+    follow: no
+    state: link
+  with_dict: "{{ openwrt_mixin }}"
+  when: '"link" in item.value'
+  loop_control:
+    label: "{{ item.key }}"
+
+- name: Copy mixins in place [2/3]
   copy:
     src: "{{ item.value.file }}"
     dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
@@ -29,7 +42,7 @@
   loop_control:
     label: "{{ item.key }}"
 
-- name: Copy mixins in place [2/2]
+- name: Copy mixins in place [3/3]
   copy:
     content: "{{ item.value.content }}"
     dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
@@ -83,7 +96,8 @@
     trim_blocks: yes
   when: openwrt_groups is defined or openwrt_users is defined
 
-- unarchive:
+- name: extract image builder tarball
+  unarchive:
     copy: False
     src:  "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
     dest: "{{ openwrt_imgbuilder_dir }}"