From 45d907e3366a05cf16946e1a42963efa8e801ed2 Mon Sep 17 00:00:00 2001 From: ace Date: Thu, 9 Feb 2023 23:14:16 +0300 Subject: [PATCH] Add http and https proxy support --- tasks/Debian/main.yaml | 16 ++++++++++++---- tasks/RedHat/main.yaml | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/tasks/Debian/main.yaml b/tasks/Debian/main.yaml index 4273655..3dbaf03 100644 --- a/tasks/Debian/main.yaml +++ b/tasks/Debian/main.yaml @@ -3,12 +3,18 @@ name: gpg - name: Add gpg keys for consul + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" ansible.builtin.apt_key: url: "{{ item.url }}" keyring: "{{ item.keyring }}" loop: "{{ consul_apt_key }}" - name: Add Hashicorp repository + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" apt_repository: repo: "{{ item.repo }}" state: present @@ -25,10 +31,6 @@ consul_installed_package: "{{ ansible_facts.packages[consul_package_name][0]['name'] }}" when: consul_package_name in ansible_facts.packages -- debug: - msg: "{{ ansible_facts.packages[consul_package_name][0]['version'] }}" - when: consul_installed_package is defined - - name: Mask Consul before install ansible.builtin.systemd: name: "{{ consul_package_name }}" @@ -36,6 +38,9 @@ when: consul_package_name not in ansible_facts.packages or ansible_facts.packages[consul_package_name][0]['version'] != (consul_version + "-" + consul_version_build) - name: "Install {{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}" + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" apt: name: "{{ consul_package }}-{{ consul_version_build }}" update_cache: yes @@ -43,6 +48,9 @@ when: consul_package_name not in ansible_facts.packages - name: "Update {{ consul_package_name }}-{{ consul_version }}-{{ consul_version_build }}" + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" apt: name: "{{ consul_package }}-{{ consul_version_build }}" update_cache: yes diff --git a/tasks/RedHat/main.yaml b/tasks/RedHat/main.yaml index ce2f014..31dfcbe 100644 --- a/tasks/RedHat/main.yaml +++ b/tasks/RedHat/main.yaml @@ -10,6 +10,9 @@ when: consul_install_repo - name: "Install {{ consul_package_name }}-{{ consul_version }} from official repository" + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" dnf: name: "{{ consul_package }}" state: present @@ -21,6 +24,9 @@ when: consul_install_repo - name: "Install {{ consul_package_name }}-{{ consul_version }}" + environment: + http_proxy: "{{ consul_install_http_proxy | default(omit) }}" + https_proxy: "{{ consul_install_https_proxy | default(omit) }}" dnf: name: "{{ consul_package }}" state: present