roles/openwrt-image: Cache downloaded files
authornicoo <nicoo@realraum.at>
Mon, 21 May 2018 00:01:13 +0000 (02:01 +0200)
committernicoo <nicoo@realraum.at>
Mon, 21 May 2018 00:01:54 +0000 (02:01 +0200)
ansible/roles/openwrt-image/tasks/prepare.yml

index 7ed93d0..b0847ec 100644 (file)
@@ -13,6 +13,7 @@
     state: directory
     mode: '0755'
   with_items:
+    - "{{ openwrt_download_dir }}/dl"
     - "{{ openwrt_imgbuilder_files }}/etc/config"
     - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
 
@@ -85,3 +86,9 @@
   command: >-
     tar -xf  "{{ openwrt_download_dir }}/{{ openwrt_tarball_name }}"
     -C   "{{ openwrt_imgbuilder_dir     }}"
+
+- name: Symlink the cache repository
+  file:
+    state: link
+    src: "{{ playbook_dir }}/{{ openwrt_download_dir }}/dl"
+    path: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/dl"