Check if multiverse repository is available in Ubuntu 97/48097/2
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Thu, 30 Nov 2017 14:13:34 +0000 (14:13 +0000)
committerRoss Brattain <ross.b.brattain@intel.com>
Fri, 22 Dec 2017 10:45:09 +0000 (10:45 +0000)
In Ubuntu, multiverse repository is needed to install the image
dependencies [1]. If this repository is not enabled, it should be
added as part of the role "add_custom_repos".

[1] https://github.com/opnfv/yardstick/tree/master/ansible/roles/install_image_dependencies

JIRA: YARDSTICK-875

Change-Id: Ie37ebf87bf245185447f2b675568af9bd38219c0
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
ansible/roles/add_custom_repos/tasks/ubuntu.yml
ansible/roles/add_custom_repos/templates/sources.list.j2

index c0ba89c..4658fe5 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 ---
+- name: Check multiverse repository
+  shell: "apt-cache policy | grep {{ release }}/multiverse"
+  args:
+      executable: /bin/bash
+  register: multiverse_repos
+  ignore_errors: yes
+
 - name: add custom repos
   template:
     src: sources.list.j2
index 4b50f45..61fbe43 100644 (file)
@@ -2,4 +2,7 @@
 deb [arch={{ YARD_IMG_ARCH }}] http://ports.ubuntu.com/ {{ release }}-backports main restricted universe multiverse
 {% else %}
 deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu/ {{ release }}-backports main restricted universe multiverse
+    {% if multiverse_repos.rc != 0 %}
+deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ {{ release }} multiverse
+    {% endif %}
 {% endif %}