X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=packaging%2Fpacker%2Fconfig_ansible.sh;h=20796323851e9aff45eae34bd8982cd0520b8169;hb=732659be50eedc962e9cf09b09ac15e459523c7a;hp=527a2f0db8cda92e0eaaa00e444f776b023f63ba;hpb=d0ad648cb47c8928ce4ad5c1d3f137d7d10a7d0d;p=integration.git diff --git a/packaging/packer/config_ansible.sh b/packaging/packer/config_ansible.sh index 527a2f0d..20796323 100644 --- a/packaging/packer/config_ansible.sh +++ b/packaging/packer/config_ansible.sh @@ -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 [,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/*