diff --git a/changelogs/fragments/5287-machinectl-become-success.yml b/changelogs/fragments/5287-machinectl-become-success.yml new file mode 100644 index 0000000000..3f71831e29 --- /dev/null +++ b/changelogs/fragments/5287-machinectl-become-success.yml @@ -0,0 +1,2 @@ +minor_changes: + - machinectl become plugin - combine the success command when building the become command to be consistent with other become plugins (https://github.com/ansible-collections/community.general/pull/5287). diff --git a/plugins/become/machinectl.py b/plugins/become/machinectl.py index 3e13dfc2a5..461a3f635d 100644 --- a/plugins/become/machinectl.py +++ b/plugins/become/machinectl.py @@ -117,7 +117,7 @@ class BecomeModule(BecomeBase): flags = self.get_option('become_flags') user = self.get_option('become_user') - return '%s -q shell %s %s@ %s' % (become, flags, user, cmd) + return '%s -q shell %s %s@ %s' % (become, flags, user, self._build_success_command(cmd, shell)) def check_success(self, b_output): b_output = self.remove_ansi_codes(b_output)