New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add an option for tower_host to merge variables instead of replacing #41687
Comments
Files identified in the description: If these files are inaccurate, please update the |
I would consider this first as a feature in tower-cli, and then update the tower modules to use that call pattern (which possibly some version detection). The approach should be the same as: That was done to solve a slightly different problem, but it handles the variable merging behavior at the correct point. The tower-cli library already does a preliminary request to get the object, and you need to modify data here to have the changed status remain accurate. |
So, the idea would be something like:
Possibly with multiple Any idea when will that land in tower-cli? |
This is such a high-impact detail across all the resources in AWX that I want to get it right. I would probably call it something different in this case, it might look like:
Then if we do it like this, the call pattern from python would look like:
We might be able to have My first interest here is credentials, but there are already bugs related to sub-fields of JSON/YAML fields in notification templates. Then, the same feature request would apply to all inventory things, job templates, etc. I'm not sure what the timeline will be, but the related credentials fix is somewhat of a priority. |
Right now @ryanpetrello is working on the new AWX CLI. Until a CLI starts to support variable merges, I would rather not put it into consideration for the modules. As I've been saying in other issues here, we are migrating these modules out of core into an independent collection at https://github.com/ansible/awx/tree/devel/awx_collection. You can re-open another request in that issue queue, but I don't personally find this issue compelling enough right now to migrate over. close_me |
SUMMARY
I want to use the
tower_host
module to add/replace one specific variable of an existing host in tower. Currently the module will remove all existing variables from the host leaving only the variable specified in the task.ISSUE TYPE
COMPONENT NAME
tower_host
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible Host: Fedora 28 with ansible-tower-cli (3.3.0)
Tower Test Host: Centos 7.5.1804 / AWX 1.0.6.16
STEPS TO REPRODUCE
Task to add/replace a variable to an existing tower host.
In order not to change the current behavior, which potentially breaks existing playbooks, maybe there should be a new parameter, like
merge_variable
, to specify that the variable(s) should be added and not completely replace existing variables:EXPECTED RESULTS
The
vm_uuid
variable should be added to the existing list of variables if it is not already there or changed if already there and different. Any other variables should not be touchedACTUAL RESULTS
The module delete all the existing variables and keep only the variables specified in the task.
The text was updated successfully, but these errors were encountered: