View stretch-preseed.cfg
#### Contents of the preconfiguration file (for stretch)
### Localization
# Preseeding only locale sets language, country and locale.
#d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
d-i debian-installer/language string en
d-i debian-installer/country string DK
d-i debian-installer/locale string en_DK.UTF-8
# Optionally specify additional locales to be generated.
View play-install-xentools.yml
- name: Install Xentools on deployed vm
hosts: deployed_vms
tasks:
- name: Mount xentools CD
command: mount /dev/xvdd /mnt
- name: Run the xentools installer
command: /mnt/Linux/install.sh -n
View task-add-dynamic-host.yml
- name: Add host to runtime inventory
add_host:
name="{{ ipaddress }}"
groups="deployed_vms"
View task-insert-xentools-cd.yml
- name: Insert Xentools CD in CDROM drive
command: xe vm-cd-insert cd-name=xs-tools.iso vm={{ vmuuid.stdout }}
when: ansible_distribution_major_version|int <= 6
- name: Insert Xentools CD in CDROM drive
command: xe vm-cd-insert cd-name=guest-tools.iso vm={{ vmuuid.stdout }}
when: ansible_distribution_major_version|int >= 7
- name: Get the last boot time for the VM
command: xe vm-param-get param-name=start-time uuid={{ vmuuid.stdout}}
View task-boot-vm.yml
- name: Boot VM and start preseed installation
command: xe vm-start uuid={{ vmuuid.stdout }}
- name: Get the boot time for the VM
command: xe vm-param-get param-name=start-time uuid={{ vmuuid.stdout}}
register: boottime
- name: Watch for the first reboot
shell: export starttime={{ boottime.stdout }}; while [[ ${starttime} == {{ boottime.stdout }} ]]; do sleep 15; starttime=`xe vm-param-get param-name=start-time uuid={{ vmuuid.stdout }}`; done
async: 1800
View task-create-cdrom.yml
- name: Create and attach CDROM drive
command: xe vbd-create type=CD device=xvdd vm-uuid={{ vmuuid.stdout }} mode=ro
View task-set-bootargs.yml
- name: Load bootargs and install repo for Debian install
include_vars:
file=group_vars/Debian.yml
when: '"Debian" in vm_template'
- name: Load bootargs and install repo for Ubuntu install
include_vars:
file=group_vars/Ubuntu.yml
when: '"Ubuntu" in vm_template'
View task-set-mem-and-network.yml
- name: Set memory
command: xe vm-memory-limits-set uuid={{ vmuuid.stdout }} dynamic-min="{{ memory }}" dynamic-max="{{ memory }}" static-max="{{ memory }}" static-min="{{ memory }}"
- name: Attach VM to {{ network_name }}
command: xe vif-create vm-uuid={{ vmuuid.stdout }} network-uuid={{ networkuuid.stdout }} mac=random device=0
View task-set-disksize.yml
- name: Get the UUID of the disk
command: xe vm-disk-list vbd-params=device=xvda uuid={{ vmuuid.stdout }} --minimal
register: vdiuuid
- name: Set disk size
command: xe vdi-resize disk-size="{{ disksize }}" uuid={{ vdiuuid.stdout }}
View task-vm-properties.yml
- name: Set vcpu priority
command: xe vm-param-set VCPUs-params:weight={{ cpu_weight }} uuid={{ vmuuid.stdout }}
- name: Set vcpu count max
command: xe vm-param-set VCPUs-max={{ vcpu_count }} uuid={{ vmuuid.stdout }}
when: vcpu_count >= "2"
- name: Set vcpu count at startup
command: xe vm-param-set VCPUs-at-startup={{ vcpu_count }} uuid={{ vmuuid.stdout }}
when: vcpu_count >= "2"