Created
March 9, 2018 09:21
-
-
Save jrisch/6e964c30803f4ee2eb0153003125a949 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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 | |
when: ubuntu_xenial_amd64.rc == 1 | |
tags: [xenserver,templates] | |
- name: Create new template | |
shell: xe vm-clone uuid={{ old_template_uuid_ubuntu_xenial_amd64.stdout }} new-name-label="Ubuntu Xenial Xerus 16.04 (64-bit)" | |
register: new_template_uuid_ubuntu_xenial_amd64 | |
when: ubuntu_xenial_amd64.rc == 1 | |
tags: [xenserver,templates] | |
- name: Register new template | |
shell: xe template-param-set other-config:default_template=true other-config:debian-release=xenial uuid={{ new_template_uuid_ubuntu_xenial_amd64.stdout }} | |
when: ubuntu_xenial_amd64.rc == 1 | |
tags: [xenserver,templates] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment