summaryrefslogtreecommitdiff
path: root/roles/openwrt/image/tasks/prepare.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openwrt/image/tasks/prepare.yml')
-rw-r--r--roles/openwrt/image/tasks/prepare.yml38
1 files changed, 19 insertions, 19 deletions
diff --git a/roles/openwrt/image/tasks/prepare.yml b/roles/openwrt/image/tasks/prepare.yml
index a3ab7112..e03fe351 100644
--- a/roles/openwrt/image/tasks/prepare.yml
+++ b/roles/openwrt/image/tasks/prepare.yml
@@ -10,49 +10,52 @@
openwrt_imgbuilder_files: "{{ tmpdir.path }}/files"
- name: Create the directories for mixins
+ loop:
+ - "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
+ - "{{ openwrt_imgbuilder_files }}/etc/config"
+ - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
file:
path: "{{ item }}"
state: directory
mode: '0755'
- with_items:
- - "{{ openwrt_download_dir }}/dl/{{ openwrt_arch }}"
- - "{{ openwrt_imgbuilder_files }}/etc/config"
- - "{{ openwrt_mixin | map('dirname') | map('regex_replace', '^', openwrt_imgbuilder_files) | unique | list }}"
- name: Copy mixins in place [1/3]
+ loop: "{{ openwrt_mixin | dict2items }}"
+ loop_control:
+ label: "{{ item.key }}"
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]
+ loop: "{{ openwrt_mixin | dict2items }}"
+ loop_control:
+ label: "{{ item.key }}"
copy:
src: "{{ item.value.file }}"
dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
mode: "{{ item.value.mode | default('0644') }}"
- with_dict: "{{ openwrt_mixin }}"
when: '"file" in item.value'
- loop_control:
- label: "{{ item.key }}"
- name: Copy mixins in place [3/3]
+ loop: "{{ openwrt_mixin | dict2items }}"
+ loop_control:
+ label: "{{ item.key }}"
copy:
content: "{{ item.value.content }}"
dest: "{{ openwrt_imgbuilder_files }}/{{ item.key }}"
mode: "{{ item.value.mode | default('0644') }}"
- with_dict: "{{ openwrt_mixin }}"
when: '"content" in item.value'
- loop_control:
- label: "{{ item.key }}"
- name: Generate /etc/fstab
+ loop: "{{ openwrt_mounts }}"
+ loop_control:
+ label: "{{ item.path }}"
mount:
fstab: "{{ openwrt_imgbuilder_files }}/etc/fstab"
state: present
@@ -64,21 +67,18 @@
dump: "{{ item.dump | default(omit) }}"
passno: "{{ item.passno | default(omit) }}"
when: openwrt_mounts is defined
- with_items: "{{ openwrt_mounts }}"
- loop_control:
- label: "{{ item.path }}"
- name: Create UCI configuration files
+ loop: "{{ openwrt_uci | dict2items }}"
+ loop_control:
+ label: "{{ item.key }}"
template:
src: uci.j2
dest: "{{ openwrt_imgbuilder_files }}/etc/config/{{ item.key }}"
mode: 0644
trim_blocks: yes
# force: no ## TODO: fail when overwriting a file
- with_dict: "{{ openwrt_uci }}"
- loop_control:
- label: "{{ item.key }}"
- name: Create /etc/passwd
template: