This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Add host to runtime inventory | |
add_host: | |
name="{{ ipaddress }}" | |
groups="deployed_vms" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Create and attach CDROM drive | |
command: xe vbd-create type=CD device=xvdd vm-uuid={{ vmuuid.stdout }} mode=ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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 }} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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" |