我收到错误:
Unsupported proxy scheme: https. Currently ansible only supports HTTP proxies
在ansible v2.3.2上运行ansible playbook但是同样使用ansible v1.9.4运行:
environment:
http_proxy: "http://{{ address }}:{{ port }}"
https_proxy: "https://{{ address }}:{{ port }}"
ansible模块是否有任何变化或如何解决这个问题?
答案 0 :(得分:2)
我排除了故障并发现我们是否设置了HTTPS_PROXY来代替http_proxy,这很奇怪,但它的工作和包正在安装。
HTTPS_PROXY: "https://{{ address }}:{{ port }}"
答案 1 :(得分:2)
ansible 2.7.1
中也存在此问题
为避免此问题,您可以设置validate_certs: false
这是一个示例:
environment:
http_proxy: http://IP:PORT
https_proxy: https://IP:PORT
,然后在您的get_url或apt任务中添加validate_certs: false
get_url:
url: url
dest: "{{ dest }}"
validate_certs: false
答案 2 :(得分:0)
我确认添加import pandas as pd
import json
df = pd.DataFrame([['xxx xxx','specs','67646546','TEST 123','R12',43,'789S','XXX','SSSS','GGG','TTT','United States of America']], columns = ['name', 'type', 'aim', 'aimd','aim1','aim2','alim1','alim2','alim3','apim','asim','context' ])
exclude_list = ['name','type','aimd','context']
data = {'entities':[]}
for key,grp in df.groupby('name'):
for idx, row in grp.iterrows():
temp_dict_alpha = {'name':key,'type':row['type'],'data' :{'attributes':{},'contexts':[{'attributes':{},'context':{'country':row['context']}}]}}
attr_row = row[~row.index.isin(['name','type'])]
for idx2,row2 in attr_row.iteritems():
if idx2 not in exclude_list:
dict_temp = {}
dict_temp[idx2] = {'values':[]}
dict_temp[idx2]['values'].append({'value':row2,'source':'internal','locale':'en_Us'})
temp_dict_alpha['data']['contexts'][0]['attributes'].update(dict_temp)
if idx2 == 'aimd':
dict_temp = {}
dict_temp[idx2] = {'values':[]}
dict_temp[idx2]['values'].append({'value':row2,'source':'internal','locale':'en_Us'})
temp_dict_alpha['data']['attributes'].update(dict_temp)
data['entities'].append(temp_dict_alpha)
print(json.dumps(data, indent = 4))
可以达到目的:
print(json.dumps(data, indent = 4))
{
"entities": [
{
"name": "xxx xxx",
"type": "specs",
"data": {
"attributes": {
"aimd": {
"values": [
{
"value": "TEST 123",
"source": "internal",
"locale": "en_Us"
}
]
}
},
"contexts": [
{
"attributes": {
"aim": {
"values": [
{
"value": "67646546",
"source": "internal",
"locale": "en_Us"
}
]
},
"aim1": {
"values": [
{
"value": "R12",
"source": "internal",
"locale": "en_Us"
}
]
},
"aim2": {
"values": [
{
"value": 43,
"source": "internal",
"locale": "en_Us"
}
]
},
"alim1": {
"values": [
{
"value": "789S",
"source": "internal",
"locale": "en_Us"
}
]
},
"alim2": {
"values": [
{
"value": "XXX",
"source": "internal",
"locale": "en_Us"
}
]
},
"alim3": {
"values": [
{
"value": "SSSS",
"source": "internal",
"locale": "en_Us"
}
]
},
"apim": {
"values": [
{
"value": "GGG",
"source": "internal",
"locale": "en_Us"
}
]
},
"asim": {
"values": [
{
"value": "TTT",
"source": "internal",
"locale": "en_Us"
}
]
}
},
"context": {
"country": "United States of America"
}
}
]
}
}
]
}
不执行以下操作:validate_certs: false