Add http and https proxy support

This commit is contained in:
ace 2023-02-09 23:14:16 +03:00
parent 9e46c26746
commit 45d907e336
Signed by: ace
GPG Key ID: 2C08973DD37A76FD
2 changed files with 18 additions and 4 deletions

View File

@ -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

View File

@ -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