Add .deb support to ansible-opendaylight 49/57549/1
authorAkshita Jha <zenith158@gmail.com>
Thu, 1 Dec 2016 09:25:37 +0000 (14:55 +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. This patch allows ODL to be installed in a debian distribution
(Debian or Ubuntu) via a deb repo.

Ansible version: 2.2.0.0
Tested for Debian 8.0 and Ubuntu 16.04

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

diff --git a/tasks/add_odl_deb_repo.yml b/tasks/add_odl_deb_repo.yml
new file mode 100755 (executable)
index 0000000..33a2425
--- /dev/null
@@ -0,0 +1,18 @@
+- name: Add the repository key to apt
+  apt_key:
+    url={{ deb_key }}
+    state=present
+
+- name: Add ODL deb repo
+  apt_repository:
+    repo={{ deb_repo_url }}
+    state=present
+    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
index 336cb35e73faef1b57ce6e1b7adb21cc5662082a..22efaa964535df124b8d1ce8f24ee7f44e61f927 100644 (file)
@@ -1,5 +1,26 @@
 ---
+- name: Debugging
+  debug: msg="{{ ansible_distribution }} {{ ansible_os_family }} {{ ansible_distribution_version }} {{ ansible_distribution_release }} {{ ansible_distribution_major_version }} {{ ansible_lsb.major_release }}"
+
+- set_fact:
+    os="{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.0"
+  when:
+    ansible_distribution == "Debian"
+- set_fact:
+    os="x{{ ansible_distribution }}_{{ ansible_distribution_version }}"
+  when:
+    ansible_distribution == "Ubuntu"
+
+- include: install_odl_via_deb_repo.yml
+  when:
+    - ansible_os_family == "Debian"
+    - install_method == "deb_repo"
+
 - include: install_odl_via_rpm_repo.yml
-  when: install_method == "rpm_repo"
+  when:
+    - ansible_os_family == "CentOS"
+    - install_method == "rpm_repo"
 - include: install_odl_via_rpm_path.yml
-  when: install_method == "rpm_path"
+  when:
+    - ansible_os_family == "CentOS"
+    - install_method == "rpm_path"
\ No newline at end of file
diff --git a/tasks/install_odl_via_deb_repo.yml b/tasks/install_odl_via_deb_repo.yml
new file mode 100755 (executable)
index 0000000..4c19541
--- /dev/null
@@ -0,0 +1,7 @@
+---
+- include: add_odl_deb_repo.yml
+
+- name: Install ODL via Deb repo
+  apt:
+    name=opendaylight
+    state=present
\ No newline at end of file
index 7bfbcd287715414addbb016bfe1270e197f74026..352b31c480d4ae2fdd60050ea600d9bbadec5cba 100644 (file)
@@ -39,17 +39,24 @@ nb_rest_port: 8080
 # Valid options:
 #   rpm_repo: Install ODL using its Yum repo config
 #   rpm_path: Install ODL from a local path or remote URL
-install_method: "rpm_repo"
+#   dep_repo: Install ODL using a debian repository
+install_method: "deb_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"
 rpm_repo_file: "opendaylight-5-release.repo"
 rpm_repo_url: "https://git.opendaylight.org/gerrit/gitweb?p=integration/packaging.git;a=blob_plain;f=rpm/example_repo_configs/opendaylight-5-release.repo;hb=refs/heads/master"
 
+# URL of the deb repository to use when installing ODL from a repo
+# NB: This will only take effect when `install_method` is "deb_repo"
+deb_repo_url: "deb http://download.opensuse.org/repositories/home:/akshitajha/{{ os }}/ /"
+# URL to add the repository key to 'apt'
+deb_key: "http://download.opensuse.org/repositories/home:akshitajha/{{ os }}/Release.key"
+
 # This will be passed as the `name` param to the Ansible `yum` module.
 # `name` param docs: "You can also pass a url or a local path to a rpm file."
 #   See: http://docs.ansible.com/ansible/yum_module.html
 # 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"
+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