Hello, I am trying to post new ssh credentials with python but it returns the list ov credentials and not creates the new credential:
def add_ssh_credentials(self, uri, token, name, description, organization, team, tipo, user, key):
“”"add ssh credential
Parameters:
- uri: awx api uri of the credentials
- token: awx token
Returns:
True/False and hosts dict or message error
Raise: :class:Myerror
“”"
heady= {‘Authorization’: 'Bearer '+token}
payload = {
“organization”: organization,
“credential_type”: tipo,
“team”: team,
“description”: description,
“name”: name,
“inputs”: {
“became_method”: “sudo”,
“username”: user,
“ssh_key_data”: key,
“api_token”: “secret”
},
}
res = requests.post(uri, data=json.dumps(payload), headers={‘content-type’: ‘application/json’}, auth=(self.user, self.password))
output=res.json()
Anyone can help me ?
Regards
Ignazio