--- - name: retrieve install iso get_url: checksum: "sha1:23dde0f195170d9fbe99547f9df75838acc95b5e" dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso" force: no url: "http://ftp.de.debian.org/debian-cd/8.6.0/multi-arch/iso-cd/debian-8.6.0-amd64-i386-netinst.iso" delegate_to: 127.0.0.1 # local action register: download - name: assert existance of seeded iso stat: path={{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso get_checksum=False get_md5=False mime=False delegate_to: 127.0.0.1 # local action register: seeded - block: - name: clear leftover tmp files file: path={{ vm_path }}/{{ lri_item }} state=absent with_items: - amdtxt.cfg - isolinux.cfg loop_control: loop_var: lri_item delegate_to: 127.0.0.1 # local action - name: manual intervention 1 - extract configs debug: msg: | ******************************* * * MANUAL ACTION NEEDED (step 1) * ----------------------------- * Please start isomaster debian-8.6.0-amd64-i386-netinst.iso * in the host-directory {{ vm_path }} * (WITHOUT stopping this playbook!) * and extract the files amdtxt.cfg and isolinux.cfg * from the iso-directory /isolinux * to the host-directory {{ vm_path }} . * ******************************* delegate_to: 127.0.0.1 # local action - name: wait for extraction of {{ vm_path }}/amdtxt.cfg wait_for: path={{ vm_path }}/amdtxt.cfg state=present timeout=900 delegate_to: 127.0.0.1 # local action - name: patch {{ vm_path }}/amdtxt.cfg lineinfile: dest: "{{ vm_path }}/amdtxt.cfg" line: " append vga=788 initrd=/install.amd/initrd.gz auto=true preseed/file=/cdrom/preseed.cfg --- quiet" regexp: "append vga=788 initrd" state: present delegate_to: 127.0.0.1 # local action - name: wait for extraction of {{ vm_path }}/isolinux.cfg wait_for: path={{ vm_path }}/isolinux.cfg state=present timeout=900 delegate_to: 127.0.0.1 # local action - name: patch {{ vm_path }}/isolinux.cfg lineinfile: dest: "{{ vm_path }}/isolinux.cfg" line: "default amd64-install" regexp: "^default " state: present delegate_to: 127.0.0.1 # local action - name: construct {{ vm_path }}/preseed.cfg template: dest: "{{ vm_path }}/preseed.cfg" src: templates/preseed.cfg delegate_to: 127.0.0.1 # local action - name: manual intervention 1 - (re)install configs debug: msg: | ******************************* * * MANUAL ACTION NEEDED (step 2) * ----------------------------- * Please replace the files amdtxt.cfg and isolinux.cfg * in the iso-directory /isolinux * with the now patched files from host-directory {{ vm_path }} . * Likewise copy preseed.cfg from the host-directory {{ vm_path }} * to the iso-directory / . * Finally save-as this patched iso file * to debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso * in the host-directory {{ vm_path }} . * ******************************* delegate_to: 127.0.0.1 # local action - name: wait for emergence of {{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso wait_for: path={{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso state=present timeout=900 delegate_to: 127.0.0.1 # local action - name: allow some time for big file to be written pause: seconds=5 delegate_to: 127.0.0.1 # local action - name: correct access rights of iso file file: mode=0644 path={{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso state=file delegate_to: 127.0.0.1 # local action when: download.changed or not seeded.stat.exists # block end #- name: regenerate seeded copy when downloaded file changed # copy: # src: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso" # dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-seeded.iso" # force: yes # remote_src: True # though remote equals local ... # when: download.changed # delegate_to: 127.0.0.1 # local action # register: chngcopy #- name: make seeded copy when absent # copy: # src: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso" # dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-seeded.iso" # force: no # remote_src: True # though remote equals local ... # delegate_to: 127.0.0.1 # local action # register: primcopy