Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Conform proxy vars #79

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/set-variables-group-vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
## 14 - (Optional) Proxy
**Variable Name** | **Description** | **Example**
:--- | :--- | :---
**proxy_env.http_proxy** | (Optional) A proxy URL to use for creating HTTP connections outside the cluster. Will be<br /> used in the install-config and applied to other Ansible hosts unless set otherwise in<br /> no_proxy below. Must follow this pattern: http://username:pswd>@ip:port | http://ocp-admin:Pa$sw0rd@9.72.10.1:80
**proxy_env.https_proxy** | (Optional) A proxy URL to use for creating HTTPS connections outside the cluster. Will be<br /> used in the install-config and applied to other Ansible hosts unless set otherwise in<br /> no_proxy below. Must follow this pattern: https://username:pswd@ip:port | https://ocp-admin:Pa$sw0rd@9.72.10.1:80
**proxy_env.no_proxy** | (Optional) A comma-separated list (no spaces) of destination domain names, IP<br /> addresses, or other network CIDRs to exclude from proxying. When using a<br /> proxy, all necessary IPs and domains for your cluster will be added automatically. See<br /> roles/get_ocp/templates/install-config.yaml.j2 for more details on the template. <br />Preface a domain with . to match subdomains only. For example, .y.com matches<br /> x.y.com, but not y.com. Use * to bypass the proxy for all listed destinations. | example.com,192.168.10.1
**env.proxy.http** | (Optional) A proxy URL to use for creating HTTP connections outside the cluster. Will be<br /> used in the install-config and applied to other Ansible hosts unless set otherwise in<br /> no_proxy below. Must follow this pattern: http://username:pswd>@ip:port | http://ocp-admin:Pa$sw0rd@9.72.10.1:80
**env.proxy.https** | (Optional) A proxy URL to use for creating HTTPS connections outside the cluster. Will be<br /> used in the install-config and applied to other Ansible hosts unless set otherwise in<br /> no_proxy below. Must follow this pattern: https://username:pswd@ip:port | https://ocp-admin:Pa$sw0rd@9.72.10.1:80
**env.proxy.no** | (Optional) A comma-separated list (no spaces) of destination domain names, IP<br /> addresses, or other network CIDRs to exclude from proxying. When using a<br /> proxy, all necessary IPs and domains for your cluster will be added automatically. See<br /> roles/get_ocp/templates/install-config.yaml.j2 for more details on the template. <br />Preface a domain with . to match subdomains only. For example, .y.com matches<br /> x.y.com, but not y.com. Use * to bypass the proxy for all listed destinations. | example.com,192.168.10.1

## 15 - (Optional) Misc
**Variable Name** | **Description** | **Example**
Expand Down
9 changes: 4 additions & 5 deletions inventories/default/group_vars/all.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ env:
fips: 'false'

# Section 14 - (Optional) Proxy

#proxy_env:
# http_proxy:
# https_proxy:
# no_proxy:
# proxy:
# http:
# https:
# no:

smolin-de marked this conversation as resolved.
Show resolved Hide resolved
# Section 15 - (Optional) Misc
language: en_US.UTF-8
Expand Down
2 changes: 1 addition & 1 deletion roles/get_ocp/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
- name: Determine whether proxy info is needed in the install-config.
tags: get_ocp
set_fact:
use_proxy: "{{ 'True' if (proxy_env.http_proxy is defined or proxy_env.https_proxy is defined or proxy_env.no_proxy is defined) else 'False' }}"
use_proxy: "{{ 'True' if (env.proxy.http is defined or env.proxy.https is defined or env.proxy.no is defined) else 'False' }}"

- name: Use template file to create install-config and backup.
tags: get_ocp
Expand Down
6 changes: 3 additions & 3 deletions roles/get_ocp/templates/install-config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: {{ env.install_config.api_version }}
baseDomain: {{ env.cluster.networking.base_domain }}
{% if use_proxy == true %}
{{ 'proxy: ' }}
{{ ' httpProxy: ' + proxy_env.http_proxy }}
{{ ' httpsProxy: ' + proxy_env.https_proxy }}
{{ ' noProxy: ' + proxy_env.no_proxy + ',' + '127.0.0.1,' + 'localhost,' +
{{ ' httpProxy: ' + env.proxy.http }}
{{ ' httpsProxy: ' + env.proxy.https }}
{{ ' noProxy: ' + env.proxy.no + ',' + '127.0.0.1,' + 'localhost,' +
env.bastion.networking.ip + ',' +
env.cluster.nodes.bootstrap.ip + ',' +
env.cluster.nodes.control.ip|join(',') + ',' +
Expand Down