Merge "Move dlux Sonar scan to Sonarcloud"
[releng/builder.git] / jjb / packaging / setup-ansible-rpm.sh
1 #!/bin/bash
2
3 # Options:
4 #   -x: Echo commands
5 #   -e: Fail on errors
6 #   -o pipefail: Fail on errors in scripts this calls, give stacktrace
7 set -ex -o pipefail
8
9 # Install required packages
10 virtualenv rpm_build
11 # shellcheck disable=SC1091
12 source rpm_build/bin/activate
13 PYTHON="rpm_build/bin/python"
14 $PYTHON -m pip install --upgrade pip
15
16 # Install Ansible
17 sudo yum install -y ansible
18
19 # Install local version of ansible-opendaylight to path expected by Ansible.
20 # Could almost do this by setting ANSIBLE_ROLES_PATH=$WORKSPACE, but Ansible
21 # expects the dir containing the role to have the name of role. The JJB project
22 # is called "ansible", which causes the cloned repo name to not match the role
23 # name "opendaylight". So we need a cp/mv either way and this is simplest.
24 sudo cp -R "$WORKSPACE"/packaging-ansible /etc/ansible/roles/opendaylight