Part of my Job is making sure our customers can run our software in Public clouds. Recently, I was able to get CloudForms Management Engine (CFME) to deploy to Azure. Once I got it done manually, I wanted to automate the deployment, and that means Ansible. Turns out that launching custom images from Ansible is not support int the current GA version of the Azure modules, but has been implemented upstream.
Ansible releases package versions here. I wanted the 2.5 that was aligned with Fedora 27 which is RC3 right now. Install using dnf:
sudo dnf install http://releases.ansible.com/ansible/rpm/preview/fedora-27-x86_64/ansible-2.5.0-0.1003.rc3.fc27.ans.noarch.rpm |
And then I can launch using the new syntax for the image dictionary. Here is the task fragment from my tasks/main.yml
- name: Create virtual machine azure_rm_virtualmachine: resource_group: "{{ az_resources }}" name: CloudForms vm_size: Standard_D1 admin_username: "{{ az_username }}" admin_password: "{{ az_password }}" image: name: cfme-azure-5.9.0.22-1 resource_group: CFME-NE |
Note the two dictionary values under image. This works, so long as the user has access to the image, even if it comes from a different resource group.
Big thanks to and In #ansible FreeNode IRC for helping get this to work.