Using Ansible to Deploy Ubuntu 16.04 on the Odroid XU-4 Cloudshell
We have an entire minion army of ARM-based computers here at Incomplete I/O HQ. This includes a number of Hardkernel Odroid XU-4 SoC systems running in the Cloudshell enclosure with LCD display and a 1TB 2.5" laptop HDD each.
Official updates generally come in the form of a disk image to write to the 16GB eMMC card installed in each. These devices represent a scratch space for running all kinds of things and as a result, we're often left wanting to re-image the devices. Any longer-term or heavily dynamic data gets stored on the hard disks anyway (and even that isn't overly critical).
Documentation exists already for this collection of hardware, but it's disparate, isn't always relevant to the Cloudshell case, and in some cases is outdated.
Manually bringing the system back up each time isn't time well spent.
With all of that in mind, this article walks through development of an Ansible playbook specifically designed to bring an XU-4 Cloudshell up from the base image. Two birds with one stone if you will.
installing Ubuntu 16.04
This is a simple case of taking the latest Ubuntu or Ubuntu minimal disk image (we prefer Ubuntu Minimal for these headless hosts) and writing it to the eMMC card using a different host. On Linux or *BSD, that's a simple dd command.
Before removing the eMMC card, we mount the rootfs partition and add at least one ssh public key from an Ansible control node as a key that the XU-4 will trust:
1: cd /mnt/root 2: mkdir .ssh 3: chmod 700 .ssh 4: cp ~/.ssh/id_ecdsa.pub .ssh/authorized_keys 5: chmod 600 .ssh/authorized_keys 6: cd / 7:
No we're ready to unmount the eMMC filesystem(s) and place the eMMC card back in the XU-4. We also have a static mapping for the MAC addresses of these Odroid systems in our DHCP server, so they'll come up on the network in a deterministic fashion (more on that another time).
running the playbook
We'll introduce the creation of the Ansible playbook below. As it's being developed, it's worth running against a test system or environment as you go, rather than wait until the end to debug typos or other issues. To execute the playbook, simply run the following command in the directory containing all of the files we'll introduce in the next section:
ansible-playbook ansible-playbook.yml -i ./ansible-hosts
Any issues ought to be highlighted in red text in the Ansible output.
orchestrating provisioning and configuration
The individual sets of tasks have been split out to potentially make it easier to read and find specific configuration items:
- Ansible Inventory
- Ansible Playbook
- Odroid XU-4 Hardware Configuration
- Odroid XU-4 Preferences
- Odroid Cloudshell filesystem mounts
- CPU governor
- Odroid Cloudshell X Session
And there you have it. Heavily-automated deployment of HardKernel Odroid XU-4 Cloudshell systems. Fly, my pretties!
A copy of the raw versions of the files we've referred to throughout this article can be found here.