From e94b48930be6e5f4fa86652ff65c5e599ae353f9 Mon Sep 17 00:00:00 2001 From: Laurent Hoss Date: Thu, 5 Jan 2017 15:19:18 +0100 Subject: [PATCH 1/3] support a custom zookeeper debian apt repository --- defaults/main.yml | 1 + tasks/Debian.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 7675470..61b77c2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,6 +8,7 @@ zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_ver # Note: by default Ubuntu 15.04 and later use systemd (but support switch to upstart) zookeeper_debian_systemd_enabled: "{{ ansible_distribution_version|version_compare(15.04, '>=') }}" zookeeper_debian_apt_install: false +zookeeper_debian_apt_repository: "" apt_cache_timeout: 3600 zookeeper_register_path_env: false diff --git a/tasks/Debian.yml b/tasks/Debian.yml index e33536f..b0e017c 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -1,4 +1,8 @@ --- +- name: Add custom apt repo (for additional zookeeper versions) + apt_repository: repo={{zookeeper_debian_apt_repository}} state=present + when: zookeeper_debian_apt_repository + - name: Update apt cache apt: update_cache=yes cache_valid_time={{apt_cache_timeout}} tags: bootstrap From 630606ec407061937a21c5e3d8e8c4d5949d6265 Mon Sep 17 00:00:00 2001 From: Laurent Hoss Date: Fri, 6 Jan 2017 11:40:56 +0100 Subject: [PATCH 2/3] more flexible list of optional apt repositories valid for a (subset of) distro version(s); example config in the README --- README.md | 6 ++++++ defaults/main.yml | 2 +- tasks/Debian.yml | 8 +++++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 29a5375..c61039b 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_ver # Note: by default Ubuntu 15.04 and later use systemd (but support switch to upstart) zookeeper_debian_systemd_enabled: "{{ ansible_distribution_version|version_compare(15.04, '>=') }}" zookeeper_debian_apt_install: false +# (Optional:) add custom 'ppa' repositories depending on the distro version (only with debian_apt_install=true) +# Example: to use a community zookeeper v3.4.8 deb pkg for Ubuntu 14.04 (where latest official is v3.4.5) +zookeeper_debian_apt_repositories: + - repository_url: "ppa:ufscar/zookeeper" + distro_version: "14.04" + apt_cache_timeout: 3600 zookeeper_register_path_env: false diff --git a/defaults/main.yml b/defaults/main.yml index 61b77c2..fa4d6a8 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -8,7 +8,7 @@ zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_ver # Note: by default Ubuntu 15.04 and later use systemd (but support switch to upstart) zookeeper_debian_systemd_enabled: "{{ ansible_distribution_version|version_compare(15.04, '>=') }}" zookeeper_debian_apt_install: false -zookeeper_debian_apt_repository: "" +zookeeper_debian_apt_repositories: [] apt_cache_timeout: 3600 zookeeper_register_path_env: false diff --git a/tasks/Debian.yml b/tasks/Debian.yml index b0e017c..b4e4090 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -1,7 +1,9 @@ --- -- name: Add custom apt repo (for additional zookeeper versions) - apt_repository: repo={{zookeeper_debian_apt_repository}} state=present - when: zookeeper_debian_apt_repository +- name: Add optional custom apt repositories (for additional zookeeper versions) + apt_repository: repo={{item.repository_url}} state=present + when: "{{ ansible_distribution_version|version_compare(item.distro_version, item.version_comparator|default('=')) }}" + with_items: + - "{{ zookeeper_debian_apt_repositories }}" - name: Update apt cache apt: update_cache=yes cache_valid_time={{apt_cache_timeout}} From 8dd152c1c6665a2c44e3289668ebba32886ca50a Mon Sep 17 00:00:00 2001 From: Laurent Hoss Date: Fri, 6 Jan 2017 11:42:18 +0100 Subject: [PATCH 3/3] bumped zookeeper_playbook_version --- README.md | 2 +- defaults/main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c61039b..749efe8 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Role Variables ```yaml --- ansible_playbook_version: 0.1 -zookeeper_playbook_version: "0.9.2" +zookeeper_playbook_version: "0.17.0" zookeeper_version: 3.4.6 zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_version}}/zookeeper-{{zookeeper_version}}.tar.gz diff --git a/defaults/main.yml b/defaults/main.yml index fa4d6a8..fd691b6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,6 @@ --- ansible_playbook_version: 0.1 -zookeeper_playbook_version: "0.9.2" +zookeeper_playbook_version: "0.17.0" zookeeper_version: 3.4.6 zookeeper_url: http://www.us.apache.org/dist/zookeeper/zookeeper-{{zookeeper_version}}/zookeeper-{{zookeeper_version}}.tar.gz