Closed davidcba1 closed 1 year ago
You can kind of see what is going on if you pass in a couple of -v
s, In the case of the 0
you get this:
ok: [localhost] => {
"changed": false,
"invocation": {
"module_args": {
"controller_config_file": null,
"controller_host": "https://localhost:8043",
"controller_oauthtoken": null,
"controller_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"controller_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"name": "LOG_AGGREGATOR_ENABLED",
"settings": null,
"validate_certs": false,
"value": "0"
}
},
"new_values": {},
"old_values": {}
}
In the case of False
you get this:
changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"controller_config_file": null,
"controller_host": "https://localhost:8043",
"controller_oauthtoken": null,
"controller_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"controller_username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"name": "LOG_AGGREGATOR_ENABLED",
"settings": null,
"validate_certs": false,
"value": "False"
}
},
"new_values": {
"LOG_AGGREGATOR_ENABLED": "False"
},
"old_values": {
"LOG_AGGREGATOR_ENABLED": false
},
"value": false
}
We may have to change the way that boolean settings are handled inside of this module.
We do some coercion of the settings that we are getting from users with this function: https://github.com/ansible/awx/blob/devel/awx_collection/plugins/modules/settings.py#L82
But then don't try and do any coercion on the values we are getting from the settings page: https://github.com/ansible/awx/blob/devel/awx_collection/plugins/modules/settings.py#L137
So we maybe comparing a string to a bool or something along those lines.
Closing as duplicate of https://github.com/ansible/awx/issues/14487
It is suggested to use:
- name: SET AWX EXPOSE HOST PATHS
awx.awx.settings:
settings:
AWX_MOUNT_ISOLATED_PATHS_ON_K8S: true
register: this_setting
The dictionary-type parameter allows us to preserve type. The problem is impossible with the "value" parameter, and we should remove it.
Please confirm the following
Bug Summary
Raised this originally here https://github.com/redhat-cop/controller_configuration/issues/459 but as suggested by them raising here.
Ansible is supposed to be idempotent, yet when you provide a setting with the value of true or false it registers a change in ansible
This is by utilising the 2 roles of the below, but applies even if you just use the settings role in the repo
AWX version
Ansible Automation Platform 2.2 - Supported/Paid version
Select the relevant components
Installation method
N/A
Modifications
no
Ansible version
ansible [core 2.13.7]
Operating system
Execution Env - 2.2-supported
Web browser
No response
Steps to reproduce
Using the roles noted above, perform some basic config change like the below
Try setting to False/false and you will notice a change every time.
Expected results
when defining your vars - regardless if you have True, true or 1 - it should not register a change
same for False, false, 0
Actual results
Additional information