From 83a95efda13862306cfcbe7d10403b51368cb223 Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Mon, 12 Jun 2017 15:21:33 -0500 Subject: [PATCH] Install specific version of Erlang from ESL The RabbitMQ community and project recommend erlang 19.3.x for the best, most stable, results. This change downloads the recommended version of erlang [ https://www.rabbitmq.com/which-erlang.html ] from ESL and moves the erlang packages for distros into a specific list installed only when the ``rabbitmq_install_method`` variable is not set to "file". Change-Id: Ief57b1fdcb791f0f8ed20c1cbb54ea19d4373f81 Signed-off-by: Kevin Carter --- defaults/main.yml | 4 ++ meta/main.yml | 5 ++ .../notes/esl-repo-6ff0c7f24ad2a043.yaml | 25 +++++++++ tasks/install_apt.yml | 55 +++++++++++-------- tasks/install_yum.yml | 39 +++++++++---- vars/debian.yml | 34 ++++++++---- vars/redhat.yml | 46 ++++++++++------ 7 files changed, 145 insertions(+), 63 deletions(-) create mode 100644 releasenotes/notes/esl-repo-6ff0c7f24ad2a043.yaml diff --git a/defaults/main.yml b/defaults/main.yml index 86b57fb9..bbb42e85 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,6 +39,10 @@ rabbitmq_release_version: "{{ _rabbitmq_release_version }}" rabbitmq_package_sha256: "{{ _rabbitmq_package_sha256 }}" rabbitmq_package_path: "{{ _rabbitmq_package_path }}" +rabbitmq_gpg_keys: "{{ _rabbitmq_gpg_keys }}" +rabbitmq_repo_url: "{{ _rabbitmq_repo_url }}" +rabbitmq_erlang_repo_url: "{{ _rabbitmq_erlang_repo_url }}" + # Choose file, distro, external_repo for rabbitmq_install_method. rabbitmq_install_method: "file" diff --git a/meta/main.yml b/meta/main.yml index 98e6538c..78a0fa25 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -34,5 +34,10 @@ galaxy_info: dependencies: - pip_install - role: apt_package_pinning + apt_package_pinning_file_name: "rabbitmq.pref" + apt_package_pinning_priority: 999 + apt_pinned_packages: + - package: "*" + release: "Erlang Solutions Ltd." when: - ansible_pkg_mgr == 'apt' diff --git a/releasenotes/notes/esl-repo-6ff0c7f24ad2a043.yaml b/releasenotes/notes/esl-repo-6ff0c7f24ad2a043.yaml new file mode 100644 index 00000000..a06b121e --- /dev/null +++ b/releasenotes/notes/esl-repo-6ff0c7f24ad2a043.yaml @@ -0,0 +1,25 @@ +--- +features: + - A new repository for installing modern erlang from ESL + (erlang solutions) has been added giving us the ability + to install and support modern stable erlang over numerous + operating systems. + - The ability to set the RabbitMQ repo URL for both erlang + and RabbitMQ itself has been added. This has been done to + allow deployers to define the location of a given repo without + having to fully redefine the entire set of definitions for a + specific repository. The default variables `rabbitmq_gpg_keys`, + `rabbitmq_repo_url`, and `rabbitmq_erlang_repo_url` have been + created to facilitate this capability. +upgrade: + - Changing to the ESL repos has no upgrade impact. The version + of erlang provided by ESL is newer than that what is found in + the distro repos. Furthermore, a pin has been added to + ensure that APT always uses the ESL repos as it's preferred + source which has been done to simply ensure APT is always + pointed at ESL. +fixes: + - Based on documentation from RabbitMQ + [ https://www.rabbitmq.com/which-erlang.html ] this change + ensures the version of erlang we're using across distros is + consistent and supported by RabbitMQ. diff --git a/tasks/install_apt.yml b/tasks/install_apt.yml index e2eaa2a9..58f96ca9 100644 --- a/tasks/install_apt.yml +++ b/tasks/install_apt.yml @@ -13,20 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install RabbitMQ package dependencies - apt: - pkg: "{{ item }}" - state: "{{ rabbitmq_package_state }}" - update_cache: yes - cache_valid_time: "{{ cache_timeout }}" - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: "{{ rabbitmq_dependencies | deprecated(rabbitmq_apt_packages, 'rabbitmq_apt_packages', 'rabbitmq_dependencies', 'Ocata') }}" - tags: - - rabbitmq-apt-packages - - block: - name: Add rabbitmq apt-keys apt_key: @@ -39,7 +25,6 @@ until: add_keys | success retries: 5 delay: 2 - when: rabbitmq_install_method == 'external_repo' with_items: "{{ rabbitmq_gpg_keys }}" tags: - rabbitmq-apt-keys @@ -57,7 +42,6 @@ delay: 2 with_items: "{{ rabbitmq_gpg_keys }}" when: - - rabbitmq_install_method == 'external_repo' - (item.fallback_keyserver is defined or item.fallback_url is defined) tags: - rabbitmq-apt-keys @@ -71,28 +55,55 @@ until: add_repos|success retries: 5 delay: 2 - when: rabbitmq_install_method == 'external_repo' + when: + - rabbitmq_install_method == 'external_repo' tags: - rabbitmq-repos -- name: Install the RabbitMQ package through a deb file +- name: Add erlang repo + apt_repository: + repo: "{{ rabbitmq_erlang_repo.repo }}" + state: "{{ rabbitmq_erlang_repo.state }}" + filename: "{{ rabbitmq_erlang_repo.filename | default(omit) }}" + register: add_repos + until: add_repos|success + retries: 5 + delay: 2 + tags: + - rabbitmq-repos + +- name: Install RabbitMQ package dependencies + apt: + pkg: "{{ rabbitmq_dependencies | deprecated(rabbitmq_apt_packages, 'rabbitmq_apt_packages', 'rabbitmq_dependencies', 'Ocata') }}" + state: "{{ rabbitmq_package_state }}" + update_cache: yes + cache_valid_time: "{{ cache_timeout }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + tags: + - rabbitmq-apt-packages + +- name: Install the RabbitMQ package deb apt: deb: "{{ rabbitmq_package_path }}" register: install_rabbitmq - when: rabbitmq_install_method == 'file' + when: + - rabbitmq_install_method == 'file' tags: - rabbitmq-package-deb - rabbitmq-apt-packages - name: Install RabbitMQ packages package: - name: "{{ item }}" + name: "{{ rabbitmq_erlang_distro_packages }}" state: "{{ rabbitmq_package_state }}" register: install_packages until: install_packages|success retries: 5 delay: 2 - with_items: "{{ rabbitmq_distro_packages }}" - when: rabbitmq_install_method != 'file' + when: + - rabbitmq_install_method != 'file' tags: - rabbitmq-apt-packages diff --git a/tasks/install_yum.yml b/tasks/install_yum.yml index 76e3142a..b1fe8f57 100644 --- a/tasks/install_yum.yml +++ b/tasks/install_yum.yml @@ -23,7 +23,6 @@ retries: 5 delay: 2 with_items: "{{ rabbitmq_gpg_keys }}" - when: rabbitmq_install_method != 'file' tags: - rabbitmq-gpg-keys @@ -38,7 +37,6 @@ delay: 2 with_items: "{{ rabbitmq_gpg_keys }}" when: - - rabbitmq_install_method != 'file' - item.fallback_keyserver is defined tags: - rabbitmq-gpg-keys @@ -55,7 +53,23 @@ gpgkey: "{{ rabbitmq_repo.gpgkey | default(omit) }}" sslverify: "{{ rabbitmq_repo.sslverify | default(omit) }}" sslcacert: "{{ rabbitmq_repo.sslcacert | default(omit) }}" - when: rabbitmq_install_method != 'file' + when: + - rabbitmq_install_method != 'file' + tags: + - rabbitmq-repos + +- name: Install erlang yum mirror + yum_repository: + name: "{{ rabbitmq_erlang_repo.name }}" + file: "{{ rabbitmq_erlang_repo.filename | default(omit) }}" + description: "{{ rabbitmq_erlang_repo.description | default(omit) }}" + baseurl: "{{ rabbitmq_erlang_repo.baseurl }}" + repo_gpgcheck: "{{ rabbitmq_erlang_repo.repo_gpgcheck | default(omit) }}" + gpgcheck: "{{ rabbitmq_erlang_repo.gpgcheck | default(omit) }}" + state: "{{ rabbitmq_erlang_repo.state }}" + gpgkey: "{{ rabbitmq_erlang_repo.gpgkey | default(omit) }}" + sslverify: "{{ rabbitmq_erlang_repo.sslverify | default(omit) }}" + sslcacert: "{{ rabbitmq_erlang_repo.sslcacert | default(omit) }}" tags: - rabbitmq-repos @@ -72,6 +86,14 @@ tags: - rabbitmq-yum-packages +- name: Install RabbitMQ packages + yum: + name: "{{ (rabbitmq_install_method == 'file') | ternary(rabbitmq_package_path, rabbitmq_distro_packages) }}" + register: install_rabbitmq + tags: + - rabbitmq-package-rpm + - rabbitmq-yum-packages + - name: Install RabbitMQ package dependencies for external_repo usage yum: pkg: "{{ item }}" @@ -81,14 +103,7 @@ retries: 5 delay: 2 with_items: "{{ rabbitmq_mirror_dependencies }}" - when: rabbitmq_install_method != 'file' + when: + - rabbitmq_install_method != 'file' tags: - rabbitmq-yum-packages - -- name: Install the RabbitMQ package - yum: - name: "{{ (rabbitmq_install_method == 'file') | ternary(rabbitmq_package_path, rabbitmq_distro_packages) }}" - register: install_rabbitmq - tags: - - rabbitmq-package-rpm - - rabbitmq-yum-packages diff --git a/vars/debian.yml b/vars/debian.yml index 4c70a5d2..261e6943 100644 --- a/vars/debian.yml +++ b/vars/debian.yml @@ -19,6 +19,28 @@ _rabbitmq_release_version: "{{ rabbitmq_package_version.split('-')[0] }}" _rabbitmq_package_sha256: "ff100febb8c409692e57f3dc98fd2fc667f83eeefa3958a6fda865ce40a40349" _rabbitmq_package_path: "/opt/rabbitmq-server.deb" +_rabbitmq_gpg_keys: + - key_name: 'rabbitmq' + keyserver: 'hkp://keyserver.ubuntu.com:80' + fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80' + hash_id: '0x6B73A36E6026DFCA' + - key_name: 'erlang_solutions' + keyserver: 'hkp://keyserver.ubuntu.com:80' + fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80' + hash_id: '0xd208507ca14f4fca' + +_rabbitmq_repo_url: "http://www.rabbitmq.com/debian" +rabbitmq_repo: + repo: "deb {{ rabbitmq_repo_url }} testing main" + state: "present" + filename: "RabbitMQ" + +_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/{{ ansible_distribution | lower }}" +rabbitmq_erlang_repo: + repo: "deb {{ rabbitmq_erlang_repo_url }} {{ ansible_distribution_release | lower }} contrib" + state: "present" + filename: els_erlang + rabbitmq_dependencies: - erlang-base-hipe - erlang-nox @@ -26,15 +48,3 @@ rabbitmq_dependencies: rabbitmq_distro_packages: - rabbitmq-server - -rabbitmq_gpg_keys: - - key_name: 'rabbitmq' - keyserver: 'hkp://keyserver.ubuntu.com:80' - fallback_keyserver: 'hkp://p80.pool.sks-keyservers.net:80' - hash_id: '0x6B73A36E6026DFCA' - -rabbitmq_apt_repo_url: "http://www.rabbitmq.com/debian" -rabbitmq_repo: - repo: "deb {{ rabbitmq_apt_repo_url }} testing main" - state: "present" - filename: "RabbitMQ" diff --git a/vars/redhat.yml b/vars/redhat.yml index f2d869f3..843712e9 100644 --- a/vars/redhat.yml +++ b/vars/redhat.yml @@ -19,8 +19,36 @@ _rabbitmq_release_version: "{{ rabbitmq_package_version.split('-')[2] }}" _rabbitmq_package_sha256: "757fc6746a1700380b3ba9bf4f00dfa16cc5a0ddc8c94636c4388e838f605c31" _rabbitmq_package_path: "/opt/rabbitmq-server.rpm" +_rabbitmq_gpg_keys: + - key_name: 'rabbitmq-release-signing-key.asc' + keyserver: 'https://www.rabbitmq.com' + - key_name: 'erlang_solutions.asc' + keyserver: 'https://packages.erlang-solutions.com/ubuntu' + +_rabbitmq_repo_url: "https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch" +rabbitmq_repo: + name: rabbitmq_rabbitmq-server + description: "RabbitMQ Server Rolling Repository" + baseurl: "{{ rabbitmq_repo_url }}" + repo_gpgcheck: yes + state: "present" + gpgkey: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" + filename: RabbitMQ + # TODO(evrardjp) Move to ssl verify yes + #sslverify: no + #sslcacert: /etc/pki/tls/certs/ca-bundle.crt + +_rabbitmq_erlang_repo_url: "https://packages.erlang-solutions.com/rpm/centos/$releasever/$basearch" +rabbitmq_erlang_repo: + name: rabbitmq_els-erlang + description: "Erlang Solutions Erlang" + baseurl: "{{ rabbitmq_erlang_repo_url }}" + repo_gpgcheck: no + state: "present" + filename: els-erlang + rabbitmq_dependencies: - - erlang + - erlang-hipe - openssl - socat @@ -30,19 +58,3 @@ rabbitmq_mirror_dependencies: rabbitmq_distro_packages: - rabbitmq-server - -rabbitmq_gpg_keys: - - key_name: 'rabbitmq-release-signing-key.asc' - keyserver: 'https://www.rabbitmq.com' - -rabbitmq_repo: - name: rabbitmq_rabbitmq-server - description: "RabbitMQ Server Rolling Repository" - baseurl: "https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/$basearch" - repo_gpgcheck: yes - state: "present" - gpgkey: "https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey" - filename: RabbitMQ - # TODO(evrardjp) Move to ssl verify yes - #sslverify: no - #sslcacert: /etc/pki/tls/certs/ca-bundle.crt