diff --git a/changelogs/fragments/8476-launchd-check-mode-changed.yaml b/changelogs/fragments/8476-launchd-check-mode-changed.yaml new file mode 100644 index 0000000000..dc1e60de36 --- /dev/null +++ b/changelogs/fragments/8476-launchd-check-mode-changed.yaml @@ -0,0 +1,2 @@ +bugfixes: + - launched - correctly report changed status in check mode (https://github.com/ansible-collections/community.general/pull/8406). diff --git a/plugins/modules/launchd.py b/plugins/modules/launchd.py index e5942ea7cf..a6427bdb2f 100644 --- a/plugins/modules/launchd.py +++ b/plugins/modules/launchd.py @@ -514,7 +514,8 @@ def main(): result['status']['current_pid'] != result['status']['previous_pid']): result['changed'] = True if module.check_mode: - result['changed'] = True + if result['status']['current_state'] != action: + result['changed'] = True module.exit_json(**result)