View xenserver-templates.yaml
# Install Ubuntu Xenial template if it does not exist
- name: Search for Ubuntu 16.04 amd64 template
shell: xe template-list | grep "Ubuntu Xenial Xerus 16.04 (64-bit)"
ignore_errors: True
register: ubuntu_xenial_amd64
tags: [xenserver,templates]
- name: Find UUID of older template
shell: xe template-list name-label="Ubuntu Trusty Tahr 14.04 (64-bit)" params=uuid --minimal
register: old_template_uuid_ubuntu_xenial_amd64
View awx-docker-compose.yml
version: '2'
services:
web:
image: ansible/awx_web:latest
depends_on:
- rabbitmq
- memcached
- postgres
ports:
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