Add robot test files for VTN Coordinator features
[integration.git] / packaging / packer / config_ansible.sh
index 527a2f0db8cda92e0eaaa00e444f776b023f63ba..20796323851e9aff45eae34bd8982cd0520b8169 100644 (file)
@@ -10,7 +10,8 @@ set -x
 sudo yum install -y epel-release
 
 # Install Ansible, required for Packer's ansible-local provisioner
-sudo yum install -y ansible
+# Git is required by the ansible-galaxy tool when installing roles
+sudo yum install -y ansible git
 
 # Install the latest release of ODL's Ansible role from Ansible Galaxy
 # The `ansible-galaxy` tool was installed by Ansible's RPM
@@ -24,8 +25,24 @@ sudo yum install -y ansible
 #     push what's version controlled, and we can't install the role
 #     pre-build manually on the remote host, so we have to let Packer
 #     own the ODL role install.
-sudo ansible-galaxy install dfarrell07.opendaylight
+# NB: The simple `ansible-galaxy install <role>[,version]` syntax doesn't
+#     support versions other than those on Ansible Galaxy, so tags. The
+#     `ansible-galaxy` command will accept more complex versions via a
+#     requirements.yml file, however. Using that to support branches,
+#     commits, and tags. See: http://stackoverflow.com/a/30176625/1011749
+# TODO: Pass this version var from packer_vars.json
+ansible_version="origin/master"
+cat > /tmp/requirements.yml << EOM
+- name: opendaylight
+  src: https://github.com/dfarrell07/ansible-opendaylight
+  version: $ansible_version
+EOM
+sudo ansible-galaxy install -r /tmp/requirements.yml
 
 # Clean up to save space
+# NB: The point of this script is to leave Ansible and ODL's role installed
+#     and ready for use by the Packer Ansible provisioner, so we can't clean
+#     up that space here. Need to clean it up in a post-install cleanup script.
+sudo yum remove -y git
 sudo yum clean all -y
 sudo rm -rf /tmp/*