Add .deb support to ansible-opendaylight 51/57551/1
authorAkshita Jha <zenith158@gmail.com>
Fri, 2 Dec 2016 23:23:05 +0000 (04:53 +0530)
committerDaniel Farrell <dfarrell@redhat.com>
Fri, 19 May 2017 16:52:26 +0000 (12:52 -0400)
This commit checks the OS and then branches for either RPM or Deb installs.
It allows ODL to be installed in a debian based distribution (Debian or Ubuntu)
using a debian repo or .deb local/remote path.

Ansible version: 2.2.0.0
Tested for Debian 8.0 and Ubuntu 16.04

Change-Id: I341c9451352733c1138403cc558d30cfd7611423
Signed-off-by: Akshita Jha <zenith158@gmail.com>
Signed-off-by: Daniel Farrell <dfarrell@redhat.com>
tasks/add_jessie_backports.yml [new file with mode: 0755]
tasks/add_odl_deb_repo.yml
tasks/install_odl.yml [changed mode: 0644->0755]
tasks/install_odl_via_deb_path.yml [new file with mode: 0755]
vars/main.yml [changed mode: 0644->0755]

diff --git a/tasks/add_jessie_backports.yml b/tasks/add_jessie_backports.yml
new file mode 100755 (executable)
index 0000000..eae634e
--- /dev/null
@@ -0,0 +1,6 @@
+- name: Add jessie-backports
+  apt_repository:
+    repo="deb http://httpredir.debian.org/debian jessie-backports main"
+    state=present
+    filename='jessie-backports'
+    update_cache=yes
\ No newline at end of file
index 33a24256583456d2b7dbf975fecb4446823eae38..1a910de63fe01249e41667a7e6d2dcb9f0ea2064 100755 (executable)
@@ -10,9 +10,4 @@
     filename='opendaylight'
     update_cache=yes
 
-- name: Add jessie-backports
-  apt_repository:
-    repo="deb http://httpredir.debian.org/debian jessie-backports main"
-    state=present
-    filename='jessie-backports'
-    update_cache=yes
\ No newline at end of file
+- include: add_jessie_backports.yml
\ No newline at end of file
old mode 100644 (file)
new mode 100755 (executable)
index 0a524a8..24c9418
@@ -1,23 +1,47 @@
 ---
+# Check the OS and branch for either RPM or Deb installs
+
+# Docs: 
+# `ansible_os_family` param: Operating System family (Debian/RedHat)
+# `ansible_distribtion` param: Operating system (Debian/Ubuntu/CentOS etc.)
+# `ansible_distribution_version` param: The complete version of the OS
+# `ansible_distribution_major_version` param: The major version of the OS
+
+# The .debs are currently hosted in OpenSUSE Build Service (OBS).
+# In OBS, the name of the .deb repository for Debian contains the OS name
+# in the form Debian_{major_version} (eg: Debian_8.0).
 - set_fact:
     os="{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.0"
   when:
     ansible_distribution == "Debian"
+
+# In OBS, the name of the .deb repository for Ubuntu contains the OS name
+# in the form xUbuntu_{version} (eg: xUbuntu_16.04).
 - set_fact:
     os="x{{ ansible_distribution }}_{{ ansible_distribution_version }}"
   when:
     ansible_distribution == "Ubuntu"
 
+# Install ODL .deb using debian repo
 - include: install_odl_via_deb_repo.yml
   when:
     - ansible_os_family == "Debian"
     - install_method == "deb_repo"
 
+# Install ODL using .deb URL or local path to a .deb file
+- include: install_odl_via_deb_path.yml
+  when:
+    - ansible_os_family == "Debian"
+    - install_method == "deb_path"
+
+# Install ODL using Yum repo config
 - include: install_odl_via_rpm_repo.yml
   when:
-    - ansible_os_family == "CentOS"
+    - ansible_os_family == "RedHat"
     - install_method == "rpm_repo"
+
+# Install ODL using rpm URL or a local path to a rpm file
 - include: install_odl_via_rpm_path.yml
   when:
-    - ansible_os_family == "CentOS"
+    - ansible_os_family == "RedHat"
     - install_method == "rpm_path"
\ No newline at end of file
diff --git a/tasks/install_odl_via_deb_path.yml b/tasks/install_odl_via_deb_path.yml
new file mode 100755 (executable)
index 0000000..afc6f72
--- /dev/null
@@ -0,0 +1,7 @@
+---
+- include: add_jessie_backports.yml
+
+- name: Install ODL via Deb path
+  apt:
+    deb: "/home/vagrant/opendaylight_5.0.0-1_all.deb"
+    state: present
old mode 100644 (file)
new mode 100755 (executable)
index 352b31c..59c9fcd
@@ -40,7 +40,7 @@ nb_rest_port: 8080
 #   rpm_repo: Install ODL using its Yum repo config
 #   rpm_path: Install ODL from a local path or remote URL
 #   dep_repo: Install ODL using a debian repository
-install_method: "deb_repo"
+install_method: "rpm_repo"
 
 # URL of the .repo config to use when installing ODL from a repo
 # NB: This will only take effect when `install_method` is "rpm_repo"
@@ -59,4 +59,11 @@ deb_key: "http://download.opensuse.org/repositories/home:akshitajha/{{ os }}/Rel
 # NB: Local paths must be relative the host being configured (think `/vagrant`)
 # NB: This will only take effect when `install_method` is "rpm_path"
 # Default to the Boron RPM hosted on the CentOS Community Build System
-rpm_path: "http://cbs.centos.org/repos/nfv7-opendaylight-5-release/x86_64/os/Packages/opendaylight-4.2.0-1.el7.noarch.rpm"
\ No newline at end of file
+rpm_path: "http://cbs.centos.org/repos/nfv7-opendaylight-5-release/x86_64/os/Packages/opendaylight-4.2.0-1.el7.noarch.rpm"
+
+# This will be passed as the `deb` param to the Ansible `apt` module.
+# `deb` param docs: "Path to a .deb package on the remote machine. If :// in the path,
+#                    ansible will attempt to download deb before installing."
+#   See: http://docs.ansible.com/ansible/apt_module.html
+# This is used when `install_method` is "deb_path"
+deb_path: "http://download.opensuse.org/repositories/home:/akshitajha/{{ os }}/all/opendaylight_5.0.0-1_all.deb"
\ No newline at end of file