From dc0fee7c092df7c2c1ff7627e33107969b46c6d2 Mon Sep 17 00:00:00 2001
From: Markos Chandras <mchandras@suse.de>
Date: Fri, 9 Mar 2018 09:17:16 +0000
Subject: xci: Move functest required packages to the functest role

The docker packages that we install in the OPNFV VM are needed by
functest so add them to the related role.

Change-Id: I6ebe76fd030859f757d41ecf20c30ab76888ee9c
Signed-off-by: Markos Chandras <mchandras@suse.de>
---
 .../osa/playbooks/configure-opnfvhost.yml          | 22 ++++++-------------
 .../roles/prepare-functest/tasks/main.yml          | 25 ++++++++++++++++------
 xci/playbooks/roles/prepare-functest/vars/main.yml | 14 ++++++++++++
 xci/var/Debian.yml                                 |  2 --
 xci/var/RedHat.yml                                 |  2 --
 xci/var/Suse.yml                                   |  2 --
 xci/var/opnfv.yml                                  |  9 --------
 7 files changed, 38 insertions(+), 38 deletions(-)
 create mode 100644 xci/playbooks/roles/prepare-functest/vars/main.yml

(limited to 'xci')

diff --git a/xci/installer/osa/playbooks/configure-opnfvhost.yml b/xci/installer/osa/playbooks/configure-opnfvhost.yml
index deeab182..202cf361 100644
--- a/xci/installer/osa/playbooks/configure-opnfvhost.yml
+++ b/xci/installer/osa/playbooks/configure-opnfvhost.yml
@@ -103,10 +103,14 @@
     - name: install python Crypto module
       package:
         name: "{{ python_crypto_package_name }}"
-    - name: install PyYAML
+    - name: install opnfv pip required packages
       pip:
-        name: pyyaml
+        name: "{{ item }}"
         state: present
+      with_items:
+        - pyyaml
+        - python-neutronclient
+        - python-openstackclient
     - name: generate password token
       command: "python pw-token-gen.py --file {{OPENSTACK_OSA_ETC_PATH}}/user_secrets.yml"
       args:
@@ -135,20 +139,6 @@
         content: "{{ xci_ssl_key }}"
         dest: "/etc/ssl/private/xci.key"
       become: true
-    - name: install opnfv required packages
-      package:
-        name: "{{ opnfv_required_packages }}"
-        state: latest
-    # Docker is needed for functest
-    - name: Ensure Docker service is started and enabled
-      service:
-        name: "{{ docker_service_name }}"
-        state: started
-        enabled: yes
-    - name: install opnfv required pip packages
-      pip:
-        name: "{{ opnfv_required_pip }}"
-        state: present
 
 - hosts: localhost
   remote_user: root
diff --git a/xci/playbooks/roles/prepare-functest/tasks/main.yml b/xci/playbooks/roles/prepare-functest/tasks/main.yml
index 243358fc..e781c4df 100644
--- a/xci/playbooks/roles/prepare-functest/tasks/main.yml
+++ b/xci/playbooks/roles/prepare-functest/tasks/main.yml
@@ -7,6 +7,24 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
+
+- name: install functest required packages
+  package:
+    name: "{{ functest_required_packages[ansible_pkg_mgr] }}"
+    state: present
+
+# Docker is needed for functest
+- name: Ensure Docker service is started and enabled
+  service:
+    name: docker
+    state: started
+    enabled: yes
+
+- name: install functest required pip packages
+  pip:
+   name: "{{ functest_required_pip }}"
+   state: present
+
 - name: check if the gateway was already set
   shell: "ip a | grep {{ gateway_ip }}"
   register: gateway_ip_result
@@ -27,10 +45,3 @@
     src: run-functest.sh.j2
     dest: /root/run-functest.sh
     mode: 0755
-
-- name: install required packages
-  package:
-    name: "{{ item }}"
-    state: present
-  with_items:
-    - wget
diff --git a/xci/playbooks/roles/prepare-functest/vars/main.yml b/xci/playbooks/roles/prepare-functest/vars/main.yml
new file mode 100644
index 00000000..3a6c8a4d
--- /dev/null
+++ b/xci/playbooks/roles/prepare-functest/vars/main.yml
@@ -0,0 +1,14 @@
+---
+functest_required_packages:
+  apt:
+    - docker.io
+    - wget
+  zypper:
+    - docker
+    - wget
+  yum:
+    - docker
+    - wget
+
+functest_required_pip:
+  - docker-py
diff --git a/xci/var/Debian.yml b/xci/var/Debian.yml
index ad3621b6..c785c65c 100644
--- a/xci/var/Debian.yml
+++ b/xci/var/Debian.yml
@@ -9,5 +9,3 @@
 ##############################################################################
 # this is the interface the VM nodes are connected to libvirt network "default"
 python_crypto_package_name: python-crypto
-docker_package_name: docker.io
-docker_service_name: docker
diff --git a/xci/var/RedHat.yml b/xci/var/RedHat.yml
index 8ea2e15a..eae7d127 100644
--- a/xci/var/RedHat.yml
+++ b/xci/var/RedHat.yml
@@ -9,5 +9,3 @@
 ##############################################################################
 # this is placeholder and left blank intentionally to complete later on
 python_crypto_package_name: python-crypto
-docker_package_name: docker
-docker_service_name: docker
diff --git a/xci/var/Suse.yml b/xci/var/Suse.yml
index 5066defa..5891aee9 100644
--- a/xci/var/Suse.yml
+++ b/xci/var/Suse.yml
@@ -9,5 +9,3 @@
 ##############################################################################
 # this is the interface the VM nodes are connected to libvirt network "default"
 python_crypto_package_name: python-pycrypto
-docker_package_name: docker
-docker_service_name: docker
diff --git a/xci/var/opnfv.yml b/xci/var/opnfv.yml
index d3924bf0..f438e577 100644
--- a/xci/var/opnfv.yml
+++ b/xci/var/opnfv.yml
@@ -43,12 +43,3 @@ OPENSTACK_OSA_HAPROXY_GIT_URL: "{{ lookup('env','OPENSTACK_OSA_HAPROXY_GIT_URL')
 HAPROXY_VERSION: "{{ lookup('env','HAPROXY_VERSION') }}"
 KEEPALIVED_GIT_URL: "{{ lookup('env','KEEPALIVED_GIT_URL') }}"
 KEEPALIVED_VERSION: "{{ lookup('env','KEEPALIVED_VERSION') }}"
-
-# install docker on opnfv host only if we are running as part of CI
-opnfv_required_packages:
-  - "{{ docker_package_name }}"
-
-opnfv_required_pip:
-  - python-openstackclient
-  - python-neutronclient
-  - docker-py
-- 
cgit