2 # Copyright (c) 2018-2019 Intel Corporation.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 proxy_vars=(http_proxy https_proxy ftp_proxy no_proxy)
17 # get proxy environment values from /etc/environment if not set
18 for proxy_var in ${proxy_vars[@]}
20 env_proxy=$(sed -ne "s/^$proxy_var=[\"\']\(.*\)[\"\']/\1/p" /etc/environment)
21 if [[ -z ${!proxy_var} ]] && [[ ! -z ${env_proxy} ]]; then
22 export ${proxy_var}=${env_proxy}
25 # add proxy configuration into proxy file
27 echo "proxy_env:" > /tmp/proxy.yml
28 for proxy_var in ${proxy_vars[@]}
30 if [[ ! -z ${!proxy_var} ]]; then
31 echo " ${proxy_var}: ${!proxy_var}" >> /tmp/proxy.yml
35 # add extra arguments file if needed
36 if ${add_extra_env}; then
37 extra_args="${extra_args} -e @/tmp/proxy.yml "
40 ANSIBLE_SCRIPTS="${0%/*}/../ansible"
42 cd ${ANSIBLE_SCRIPTS} && \
44 ${extra_args} -i kube-inventory.ini deploy_kube.yml