diff --git a/changelogs/fragments/458-rshm_repository-reduce_execution_time_when_changed_is_false.yml b/changelogs/fragments/458-rshm_repository-reduce_execution_time_when_changed_is_false.yml new file mode 100644 index 0000000000..3cfd53f503 --- /dev/null +++ b/changelogs/fragments/458-rshm_repository-reduce_execution_time_when_changed_is_false.yml @@ -0,0 +1,3 @@ +bugfixes: + - rshm_repository - reduce execution time when changed is False + (https://github.com/ansible-collections/community.general/pull/458). diff --git a/plugins/modules/packaging/os/rhsm_repository.py b/plugins/modules/packaging/os/rhsm_repository.py index 7d445e9d2e..505c6c94b6 100644 --- a/plugins/modules/packaging/os/rhsm_repository.py +++ b/plugins/modules/packaging/os/rhsm_repository.py @@ -217,7 +217,7 @@ def repository_modify(module, state, name, purge=False): 'before_header': "RHSM repositories", 'after_header': "RHSM repositories"} - if not module.check_mode: + if not module.check_mode and changed: rc, out, err = run_subscription_manager(module, rhsm_arguments) results = out.splitlines() module.exit_json(results=results, changed=changed, repositories=updated_repo_list, diff=diff)