ansible-ffibk/loctevm-provide-iso.inc.yml

129 lines
4.5 KiB
YAML
Raw Normal View History

2016-07-24 01:57:37 +02:00
---
- name: retrieve install iso
get_url:
2016-11-22 16:23:01 +01:00
checksum: "sha1:23dde0f195170d9fbe99547f9df75838acc95b5e"
dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso"
2016-07-24 01:57:37 +02:00
force: no
2016-11-22 16:23:01 +01:00
url: "http://ftp.de.debian.org/debian-cd/8.6.0/multi-arch/iso-cd/debian-8.6.0-amd64-i386-netinst.iso"
2016-07-24 01:57:37 +02:00
delegate_to: 127.0.0.1 # local action
register: download
- name: assert existance of seeded iso
2016-11-22 16:23:01 +01:00
stat: path={{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso
2016-07-24 01:57:37 +02:00
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)
* -----------------------------
2016-11-22 16:23:01 +01:00
* Please start isomaster debian-8.6.0-amd64-i386-netinst.iso
2016-07-24 01:57:37 +02:00
* 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
2016-07-26 17:32:47 +02:00
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
2016-11-22 16:23:01 +01:00
* to debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso
2016-07-26 17:32:47 +02:00
* in the host-directory {{ vm_path }} .
*
*******************************
2016-07-24 01:57:37 +02:00
delegate_to: 127.0.0.1 # local action
2016-11-22 16:23:01 +01:00
- 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
2016-07-24 01:57:37 +02:00
state=present timeout=900
delegate_to: 127.0.0.1 # local action
2016-07-26 17:32:47 +02:00
- 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
2016-11-22 16:23:01 +01:00
file: mode=0644 path={{ vm_path }}/debian-8.6.0-amd64-i386-{{ inventory_hostname }}.iso state=file
2016-07-26 17:32:47 +02:00
delegate_to: 127.0.0.1 # local action
2016-07-24 01:57:37 +02:00
when: download.changed or not seeded.stat.exists
2016-07-26 17:32:47 +02:00
# block end
2016-07-24 01:57:37 +02:00
#- name: regenerate seeded copy when downloaded file changed
# copy:
2016-11-22 16:23:01 +01:00
# src: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso"
# dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-seeded.iso"
2016-07-24 01:57:37 +02:00
# 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:
2016-11-22 16:23:01 +01:00
# src: "{{ vm_path }}/debian-8.6.0-amd64-i386-netinst.iso"
# dest: "{{ vm_path }}/debian-8.6.0-amd64-i386-seeded.iso"
2016-07-24 01:57:37 +02:00
# force: no
# remote_src: True # though remote equals local ...
# delegate_to: 127.0.0.1 # local action
# register: primcopy