30.4. 使用 Ansible 为代理配置主机
在集群安装过程中,可以使用 openshift_no_proxy、openshift_http_proxy 和 openshift_https_proxy 参数配置 NO_PROXY、HTTP_PROXY 和 HTTPS_PROXY 环境变量,这些变量可在清单文件中进行配置。
使用 Ansible 的代理配置示例
# Global Proxy Configuration
# These options configure HTTP_PROXY, HTTPS_PROXY, and NOPROXY environment
# variables for docker and master services.
openshift_http_proxy=http://<user>:<password>@<ip_addr>:<port>
openshift_https_proxy=https://<user>:<password>@<ip_addr>:<port>
openshift_no_proxy='.hosts.example.com,some-host.com'
#
# Most environments do not require a proxy between OpenShift masters, nodes, and
# etcd hosts. So automatically add those host names to the openshift_no_proxy list.
# If all of your hosts share a common domain you may wish to disable this and
# specify that domain above.
# openshift_generate_no_proxy_hosts=True
注意
您可以使用 Ansible 参数 为构建 配置额外的 代理设置。例如:
openshift_builddefaults_git_http_proxy 和 openshift_builddefaults_git_https_proxy 参数 允许您使用代理进行 Git 克隆
openshift_builddefaults_http_proxy 和 openshift_builddefaults_https_proxy 参数可以将环境变量提供给 Docker 构建策略 和 Custom 构建策略 进程。