Automating XenServer Updates With Ansible


If you are using the free version of XenServer 6.2 then you cannot use the XenCenter application to update your Xen hosts. A small price to pay for such a great tool. It can still be done using the Xen CLI. Here are the steps for updating a XenServer pool:

  1. Determine which host is the pool master by running the command xe pool-list params=uuid,master from the console of a host in the pool. Use that host in your Ansible playbook.
  2. Use XenCenter to find the latest updates and then download them to your Ansible workstation.
  3. Unzip the update file so that you have a file called X.update. This file must be accessible to the Ansible script I list below.
  4. Update the Ansible playbook with your values. You must add the full path to the update file in the copy task. Run it. It may take a long time.
  5. Check that the update worked by looking at the logs and the Updates area of the General tab. You may need to reboot the hosts. The recent 6.2 SP1 update required a reboot.

The Ansible playbook is:


---

- hosts: [pool master FQDN]
user: root
gather_facts: False

tasks:
- name: Copy update file to master
copy: src=[path to update file] dest=/root

- name: Add update to patch list
command: xe patch-upload file-name=/root/{{ update_filename }}
register: uuid

- name: Install update to all servers in the pool
command: xe patch-pool-apply uuid={{ uuid.stdout }}

These steps are described by Citrix in this article.



Categories: DevOps

Tags: , ,

Share Your Ideas

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: