-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathvmware_iso_prep.yml
78 lines (67 loc) · 2.29 KB
/
vmware_iso_prep.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- hosts: bastion_host
gather_facts: no
## become: true
tasks:
- name: Mount installation ISO read-only
mount:
path: "{{ mnt_dir }}"
src: "{{ org_iso }}"
fstype: "iso9660"
opts: loop,ro
state: mounted
become: true
- name: Copy Iso content to workingdir
copy:
src: "{{ mnt_dir }}/"
dest: "{{ wrk_dir }}/"
remote_src: yes
become: true
# needs to run as root otherwise all files will change ownership
- name: Unmount installation ISO
mount:
path: "{{ mnt_dir }}"
state: unmounted
become: true
- name: create custom kickstart file
template:
src: "{{ ks_template }}"
dest: "{{ ks_dest }}"
owner: root
group: root
become: true
- name: add boot options
# Replace before the expression till the begin of the file (requires >=2.4)
replace:
path: "{{ bootcfg_dest }}"
regexp: '^(kernelopt=.*)$'
#replace: '\1 {{ bootoption }}' # would add our options to the existing ones
replace: 'kernelopt={{ bootoption }}' # adds our options instead of the existing ones
become: true
- name: add boot options II
# Replace before the expression till the begin of the file (requires >=2.4)
replace:
path: "{{ bootcfg_dest2 }}"
regexp: '^(kernelopt=.*)$'
#replace: '\1 {{ bootoption }}' # would add our options to the existing ones
replace: 'kernelopt={{ bootoption }}' # adds our options instead of the existing ones
become: true
- name: assure destination directory to be in place
file:
path: "{{ bastion_iso_dir }}"
state: directory
modification_time: preserve
access_time: preserve
become: true
- name: create customized iso image
shell: "genisoimage -relaxed-filenames -J -R -o {{ cust_iso }} -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e efiboot.img -no-emul-boot {{ wrk_dir }}"
become: true
# not needed as we create the iso right into the bastion_iso_dir
# - name: put customized iso image in place
# copy:
# src: "{{ cust_iso }}"
# dest: "{{ bastion_iso_dir }}"
# remote_src: yes
# owner: root
# group: root
# mode: '0644'