If you want to use extra vars via REST API, myvars needs to have extra_vars key.
For example, here's like.
#!/usr/bin/env python
import requests
def main():
url = "http://awx_server/api/v2/job_templates/14/launch/"
username = "admin"
passwd = "secret"
headers = {
"Content-Type": "application/json",
}
data = {}
data['extra_vars'] = {
"extra_string": "test message"
}
req = requests.post(url,
headers=headers,
auth=(username, passwd),
json=data,
verify=False)
print(req.status_code)
print(req.text)
if __name__ == "__main__":
main()
When the above sample, set test message
to extra_string
variable.
The extra_string is to be given as extra vars via REST API.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…