Update ansible variable overrides over the api gives error

Attempting to update a ansible variable override using the api ansible/api/v2/ansible_override_values like this:

curl -v -u "user:pass" -X POST https://satellite.myorg.tld/ansible/api/v2/ansible_override_values \
   -H "Content-Type: application/json" \
   -d '{
         "ansible_variable_id": "335",
         "override_value": {
           "match": "domain=myorg.tld",
           "value": "new_value"

produces a error:

  "error": {"message":"Validation failed: Match has already been taken, Match has already been taken"}

So it seems that to update a variable override match I have to first delete the override and then create it again.

I can however update the default override without issues, by using the /ansible/api/v2/ansible_variables/{var_id} api endpoint.

Expected outcome:
I expected to be able to update the ansible variable overrides.

Foreman and Proxy versions:
Red Hat Satellite (build: 6.14.4)

Foreman and Proxy plugin versions:

Distribution and version:
Red Hat Enterprise Linux release 8.9 (Ootpa)

Other relevant data:

Have you tried PUT instead of POST when changing stuff?

Yep, the PUT gives 404 for the /ansible_override_values api endpoint

Decided to just go ahead and implement it myself: feat: enable updating ansible override values via api by gardar · Pull Request #719 · theforeman/foreman_ansible · GitHub

1 Like