torwachter: rm d3 key as he does no longer want access as told by ruru. Also better...
[noc.git] / ansible / roles / openwrt / image / tasks / main.yml
1 ---
2 - include: fetch.yml
3   run_once: true
4   when: openwrt_imgbuilder_tarball is not defined
5
6 - block:
7     - include: prepare.yml
8
9     - name: Create the output directory for built images
10       file:
11         path: "{{ openwrt_output_dir }}"
12         state: directory
13
14     - name: generate list of packages to add or remove
15       set_fact:
16         openwrt_packages: >-
17           {{ openwrt_packages_remove | map('regex_replace', '^', '-') | join(' ') }}
18           {{ openwrt_packages_add   | join(' ') }}
19           {{ openwrt_packages_extra | join(' ') }}
20
21     - name: Build the OpenWrt image
22       command: >-
23         make -C {{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }} image
24           {% if openwrt_profile is defined %}PROFILE="{{ openwrt_profile }}" {% endif %}
25           FILES="{{ openwrt_imgbuilder_files }}"
26           PACKAGES="{{ openwrt_packages }}"
27           {% if openwrt_extra_name is defined %} EXTRA_IMAGE_NAME="{{ openwrt_extra_name }}" {% endif %}
28
29     - name: Copy newly built OpenWrt image
30       with_items: "{{ openwrt_output_image_suffixes }}"
31       copy:
32         src: "{{ openwrt_imgbuilder_dir }}/{{ openwrt_tarball_basename }}/bin/targets/{{ openwrt_arch }}/{{ openwrt_target }}/{{ openwrt_output_image_name_base }}-{{ item }}"
33         dest: "{{ openwrt_output_dir }}"
34
35   always:
36     - name: Delete the temporary build directory
37       file:
38         path: "{{ openwrt_imgbuilder_dir }}"
39         state: absent