You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some environments (eg production), we don't want to grant the Ansible system permission to manage Koji user accounts, but we do want check mode to fail loudly if the requisite user accounts do not exist for koji_tag or koji_tag_packages. When it fails, administrators will follow the standard (semi-manual) user setup creation processes, or more likely, correct typos.
In other environments (eg non-prod, devel environments), we expect to grant Ansible full admin access to manage user accounts. We don't want koji_tag or koji_tag_packages check mode to fail if the requisite user accounts do not exist, because Ansible will create them in the playbook with koji_user in non-check mode.
Let's add a ANSIBLE_STRICT_USER_CHECK_MODE environment variable that controls this behavior:
When ANSIBLE_STRICT_USER_CHECK_MODE is set to true, we'll fail the playbook run if we're in check mode and any requisite user accounts do not exist. This means we'll verify existence of every user account listed in the packages parameter of the koji_tag and koji_tag_packages modules.
When ANSIBLE_STRICT_USER_CHECK_MODE is unset or false, we will not check user accounts in check mode (the existing behavior)
Since these getUser checks to the hub are slow and expensive, only perform them if check mode determines that result['changed'] is True.
A future optimization would be to narrow down the conditions further, like only if packages changed, or only test the exact user accounts that Ansible would have added to the tag. Unfortunately the result dictionary does not have that info easily available. From our experience in writing this feature in python-errata-tool, that complicates the implementation, and the best bang-for-the-buck performance optimization is simply checking that result['changed'].
The text was updated successfully, but these errors were encountered:
Similar to ktdreyer/errata-tool-ansible#217 , we need to optionally surface missing user accounts sooner, in check mode.
In some environments (eg production), we don't want to grant the Ansible system permission to manage Koji user accounts, but we do want check mode to fail loudly if the requisite user accounts do not exist for
koji_tag
orkoji_tag_packages
. When it fails, administrators will follow the standard (semi-manual) user setup creation processes, or more likely, correct typos.In other environments (eg non-prod, devel environments), we expect to grant Ansible full admin access to manage user accounts. We don't want
koji_tag
orkoji_tag_packages
check mode to fail if the requisite user accounts do not exist, because Ansible will create them in the playbook withkoji_user
in non-check mode.Let's add a
ANSIBLE_STRICT_USER_CHECK_MODE
environment variable that controls this behavior:When
ANSIBLE_STRICT_USER_CHECK_MODE
is set totrue
, we'll fail the playbook run if we're in check mode and any requisite user accounts do not exist. This means we'll verify existence of every user account listed in thepackages
parameter of thekoji_tag
andkoji_tag_packages
modules.When
ANSIBLE_STRICT_USER_CHECK_MODE
is unset orfalse
, we will not check user accounts in check mode (the existing behavior)Since these
getUser
checks to the hub are slow and expensive, only perform them if check mode determines thatresult['changed']
isTrue
.A future optimization would be to narrow down the conditions further, like only if packages changed, or only test the exact user accounts that Ansible would have added to the tag. Unfortunately the
result
dictionary does not have that info easily available. From our experience in writing this feature in python-errata-tool, that complicates the implementation, and the best bang-for-the-buck performance optimization is simply checking thatresult['changed']
.The text was updated successfully, but these errors were encountered: