Fix HATop for haproxy

Readjust hatop installtion method, removed haproxy_hatop_downloader and
deployment-host variables. added "haproxy_hatop_install | bool" condition.

Change-Id: I51423fff67e6e427f6c7d163d8d1aac6bcd82ca9
This commit is contained in:
Satish Patel 2020-12-28 22:05:26 +00:00
parent ca2c011cf2
commit 0ef22fa4df
3 changed files with 42 additions and 31 deletions

View File

@ -117,9 +117,8 @@ haproxy_ssl_letsencrypt_acl:
haproxy_hatop_download_url: "https://github.com/jhunt/hatop/archive/v0.8.0.tar.gz" haproxy_hatop_download_url: "https://github.com/jhunt/hatop/archive/v0.8.0.tar.gz"
haproxy_hatop_download_checksum: "sha256:bcdab1664358ec83027957df11bbeb322df1a96d414a3ccc4e211532b82c4ad2" haproxy_hatop_download_checksum: "sha256:bcdab1664358ec83027957df11bbeb322df1a96d414a3ccc4e211532b82c4ad2"
# Where the extra package download is executed from. # Install hatop
# Options are ['deployment-host', 'target-host'] haproxy_hatop_install: true
haproxy_hatop_downloader: "deployment-host"
# The location where the extra packages are downloaded to # The location where the extra packages are downloaded to
haproxy_hatop_download_path: "/opt/cache/files" haproxy_hatop_download_path: "/opt/cache/files"

View File

@ -0,0 +1,10 @@
---
upgrade:
- |
Variable ``haproxy_hatop_downloader`` has been removed, Deployers
supposed to use ``haproxy_hatop_download_url`` override if needed
to install in deployments with limited internet connection.
features:
- |
Added new variable ``haproxy_hatop_install``, that allows to conditionally
enable or disable hatop installation.

View File

@ -24,37 +24,39 @@
retries: 5 retries: 5
delay: 2 delay: 2
- name: Ensure haproxy_hatop_download_path exists - name: Install HATop Utility
file: block:
path: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}" - name: Ensure haproxy_hatop_download_path exists on haproxy
state: directory file:
delegate_to: "{{ (haproxy_hatop_downloader == 'deployment-host') | ternary('localhost', inventory_hostname) }}" path: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}"
state: directory
- name: Download extra package - name: Download hatop package
get_url: get_url:
url: "{{ haproxy_hatop_download_url }}" url: "{{ haproxy_hatop_download_url }}"
dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}" dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}"
validate_certs: "{{ haproxy_hatop_download_validate_certs }}" validate_certs: "{{ haproxy_hatop_download_validate_certs }}"
checksum: "{{ haproxy_hatop_download_checksum }}" checksum: "{{ haproxy_hatop_download_checksum }}"
register: fetch_url register: fetch_url
until: fetch_url is success until: fetch_url is success
retries: 3 retries: 3
delay: 10 delay: 10
delegate_to: "{{ (haproxy_hatop_downloader == 'deployment-host') | ternary('localhost', inventory_hostname) }}"
- name: Unarchive HATop - name: Unarchive HATop
unarchive: unarchive:
src: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}" src: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename }}"
remote_src: "{{ (haproxy_hatop_downloader == 'deployment-host') | ternary('no', 'yes') }}" dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}"
dest: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}" remote_src: yes
extra_opts: extra_opts:
- --strip-components=1 - --strip-components=1
- name: Install HATop - name: Copy HATop binary
command: "install -m 755 bin/hatop /usr/local/bin" copy:
args: src: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}/bin/hatop"
chdir: "{{ haproxy_hatop_download_path }}/{{ haproxy_hatop_download_url | basename | replace('.tar.gz', '') }}" dest: /usr/local/bin/hatop
creates: "/usr/local/bin/hatop" mode: 0755
remote_src: yes
when: haproxy_hatop_install | bool
- include_tasks: haproxy_apparmor.yml - include_tasks: haproxy_apparmor.yml
when: ansible_pkg_mgr == 'zypper' when: ansible_pkg_mgr == 'zypper'