From 09d9f5ce58df609e6dc406e8d70144ea8fa826ac Mon Sep 17 00:00:00 2001 From: George Shuklin Date: Thu, 6 Sep 2018 15:00:41 +0300 Subject: [PATCH 1/2] Now it's possible to define own clickhouse_repo variable to prove an apt configuration string to use. Also it's possible to define own key id and/or keyserver to download the apt key, and/or to provide the apt key within a variable `clickhouse_repo_key_data`. Closes: #15 --- README.md | 31 +++++++++++++++++++++++++++++++ defaults/main.yml | 14 ++++++++++++++ tasks/main.yml | 5 ----- vars/Debian_jessie.yml | 12 ------------ vars/Debian_stretch.yml | 12 ------------ vars/Ubuntu_trusty.yml | 13 ------------- vars/Ubuntu_xenial.yml | 13 ------------- 7 files changed, 45 insertions(+), 55 deletions(-) delete mode 100644 vars/Debian_jessie.yml delete mode 100644 vars/Debian_stretch.yml delete mode 100644 vars/Ubuntu_trusty.yml delete mode 100644 vars/Ubuntu_xenial.yml diff --git a/README.md b/README.md index a732f8a..4e3897f 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,37 @@ F: Flag for remove clickhouse from host(disabled by default) clickhouse_remove: no ``` +Private mirror +-------------- +To use a private APT mirror you need to define your own repository 'string' and +the repo key. Key may be provided as key name to download from a keyserver or +as armored GPG public key (the key itself). To use a key from a keyring, +variables `clickhouse_repo_key` and `clickhouse_repo_keyserver` should be provided. +To use a key in verbatim form, `clickhouse_repo_key_data` should be provided. +Custom mirror may be provided with `clickhouse_repo` variable. +Examples: +``` +clickhouse_repo: 'deb http://apt.example.com/aptly/clickhouse xenial main' +clickhouse_repo_key: AABBCCDD +clickhouse_repo_keyserver: keyserver.example.com +``` +or +``` +clickhouse_repo: 'deb http://apt.example.com/aptly/clickhouse xenial main' +clickhouse_repo_key_data: | + -----BEGIN PGP PUBLIC KEY BLOCK----- + Version: GnuPG v1.4.12 (GNU/Linux) + mQANBFGspxsACADWgH5qqQtEa+Bjqd33X0PiRNcUf/Vt9m828uUuF5uRCEKruUG0 + (few lines skipped) + LU/GfPzkCXlOt3Ud4L2EdvgQp/38VCNKmWi568soZnTwpjUt9AuN7iK3fm4= + =4dWC + -----END PGP PUBLIC KEY BLOCK----- +``` + +Please note, you need to create your mirror to be able to use it, and how to do +this is outside of the scope of this document. You may want to try to use reprepro +or aptly for this. + Example Playbook ---------------- diff --git a/defaults/main.yml b/defaults/main.yml index 4691b55..be18b34 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,20 @@ --- # defaults file for clickhouse +# Settings for apt repo +clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" +clickhouse_repo_old: "deb http://repo.yandex.ru/clickhouse/xenial stable main" +clickhouse_repo_keyserver: keyserver.ubuntu.com +clickhouse_repo_key: E0C56BD4 +clickhouse_package: + - clickhouse-client + - clickhouse-server-base + - clickhouse-server-common +clickhouse_path_configdir: "/etc/clickhouse-server" +clickhouse_path_logdir: "/var/log/clickhouse-server" +clickhouse_path_data: "/var/lib/clickhouse/" +clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" + #Flag for using with requirements check clickhouse_supported: no #Type of installation (package,source) diff --git a/tasks/main.yml b/tasks/main.yml index 84d0ba7..f503381 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,10 +1,5 @@ --- # tasks file for clickhouse -- include_vars: "{{ item }}" - with_first_found: - - "../vars/{{ ansible_distribution }}_{{ ansible_distribution_release }}.yml" - - "../vars/empty.yml" - tags: [always] - include: precheck.yml tags: [precheck,install] diff --git a/vars/Debian_jessie.yml b/vars/Debian_jessie.yml deleted file mode 100644 index 5e6fb22..0000000 --- a/vars/Debian_jessie.yml +++ /dev/null @@ -1,12 +0,0 @@ -clickhouse_supported: yes -clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -clickhouse_repo_keyserver: keyserver.ubuntu.com -clickhouse_repo_key: E0C56BD4 -clickhouse_package: - - clickhouse-client - - clickhouse-common-static - - clickhouse-server -clickhouse_path_configdir: "/etc/clickhouse-server" -clickhouse_path_logdir: "/var/log/clickhouse-server" -clickhouse_path_data: "/var/lib/clickhouse/" -clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" diff --git a/vars/Debian_stretch.yml b/vars/Debian_stretch.yml deleted file mode 100644 index 5e6fb22..0000000 --- a/vars/Debian_stretch.yml +++ /dev/null @@ -1,12 +0,0 @@ -clickhouse_supported: yes -clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -clickhouse_repo_keyserver: keyserver.ubuntu.com -clickhouse_repo_key: E0C56BD4 -clickhouse_package: - - clickhouse-client - - clickhouse-common-static - - clickhouse-server -clickhouse_path_configdir: "/etc/clickhouse-server" -clickhouse_path_logdir: "/var/log/clickhouse-server" -clickhouse_path_data: "/var/lib/clickhouse/" -clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" diff --git a/vars/Ubuntu_trusty.yml b/vars/Ubuntu_trusty.yml deleted file mode 100644 index 35fa61a..0000000 --- a/vars/Ubuntu_trusty.yml +++ /dev/null @@ -1,13 +0,0 @@ -clickhouse_supported: yes -clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -clickhouse_repo_old: "deb http://repo.yandex.ru/clickhouse/xenial stable main" -clickhouse_repo_keyserver: keyserver.ubuntu.com -clickhouse_repo_key: E0C56BD4 -clickhouse_package: - - clickhouse-client - - clickhouse-common-static - - clickhouse-server -clickhouse_path_configdir: "/etc/clickhouse-server" -clickhouse_path_logdir: "/var/log/clickhouse-server" -clickhouse_path_data: "/var/lib/clickhouse/" -clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" diff --git a/vars/Ubuntu_xenial.yml b/vars/Ubuntu_xenial.yml deleted file mode 100644 index 35fa61a..0000000 --- a/vars/Ubuntu_xenial.yml +++ /dev/null @@ -1,13 +0,0 @@ -clickhouse_supported: yes -clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" -clickhouse_repo_old: "deb http://repo.yandex.ru/clickhouse/xenial stable main" -clickhouse_repo_keyserver: keyserver.ubuntu.com -clickhouse_repo_key: E0C56BD4 -clickhouse_package: - - clickhouse-client - - clickhouse-common-static - - clickhouse-server -clickhouse_path_configdir: "/etc/clickhouse-server" -clickhouse_path_logdir: "/var/log/clickhouse-server" -clickhouse_path_data: "/var/lib/clickhouse/" -clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" From 5000990266772800a89b075b9b7057d87de8e856 Mon Sep 17 00:00:00 2001 From: George Shuklin Date: Thu, 6 Sep 2018 15:20:32 +0300 Subject: [PATCH 2/2] Change the way distro support is checked, added bionic support. Travis supports only for trusty, so other distros couldn't be tested. Now there is a clickhouse_supported_distros list with list of supported versions in form of string: '{{ ansible_distribution }}_{{ ansible_distribution_release }}' --- .travis.yml | 12 ++++++++++++ defaults/main.yml | 11 +++++++++-- tasks/precheck.yml | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7626564..ed029cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,18 @@ matrix: dist: xenial sudo: true env: ANSIBLE_VERSION='ansible>=2.3,<2.4' + - os: linux + dist: bionic + sudo: true + env: ANSIBLE_VERSION='ansible>=2.3,<2.4' + - os: linux + dist: jessie + sudo: true + env: ANSIBLE_VERSION='ansible>=2.4,<2.5' + - os: linux + dist: stretch + sudo: true + env: ANSIBLE_VERSION='ansible>=2.4,<2.5' - os: linux dist: xenial sudo: true diff --git a/defaults/main.yml b/defaults/main.yml index be18b34..4bc4ac1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,15 @@ --- # defaults file for clickhouse +# List of distors supported by this playbook +clickhouse_supported_distros: + - 'Debian_jessie' + - 'Debian_stretch' + - 'Ubuntu_precise' + - 'Ubuntu_trusty' + - 'Ubuntu_xenial' + - 'Ubuntu_bionic' + # Settings for apt repo clickhouse_repo: "deb http://repo.yandex.ru/clickhouse/deb/stable/ main/" clickhouse_repo_old: "deb http://repo.yandex.ru/clickhouse/xenial stable main" @@ -15,8 +24,6 @@ clickhouse_path_logdir: "/var/log/clickhouse-server" clickhouse_path_data: "/var/lib/clickhouse/" clickhouse_path_tmp: "/var/lib/clickhouse/tmp/" -#Flag for using with requirements check -clickhouse_supported: no #Type of installation (package,source) clickhouse_setup: package #Flag for remove clickhouse from host(disabled by default) diff --git a/tasks/precheck.yml b/tasks/precheck.yml index 95e78bc..9573af9 100644 --- a/tasks/precheck.yml +++ b/tasks/precheck.yml @@ -7,7 +7,7 @@ - name: Requirements check | Not supported distribution && release fail: msg: "Your distribution {{ ansible_distribution }}_{{ ansible_distribution_release }} not supported by this role,sorry." - when: clickhouse_supported|bool != True + when: ('{{ ansible_distribution }}_{{ ansible_distribution_release }}' not in clickhouse_supported_distros) - name: Requirements check | Check if Clickhouse is installed shell: dpkg-query -f '${Package} ' -W |grep -q "{{ clickhouse_package| join(" ")}}"