diff --git a/changelogs/fragments/8263-apt_rpm-install-check.yml b/changelogs/fragments/8263-apt_rpm-install-check.yml
new file mode 100644
index 0000000000..ae44616e79
--- /dev/null
+++ b/changelogs/fragments/8263-apt_rpm-install-check.yml
@@ -0,0 +1,2 @@
+bugfixes:
+  - "apt_rpm - when checking whether packages were installed after running ``apt-get -y install <packages>``, only the last package name was checked (https://github.com/ansible-collections/community.general/pull/8263)."
diff --git a/plugins/modules/apt_rpm.py b/plugins/modules/apt_rpm.py
index 4c632a6fd2..78643292a4 100644
--- a/plugins/modules/apt_rpm.py
+++ b/plugins/modules/apt_rpm.py
@@ -204,7 +204,7 @@ def install_packages(module, pkgspec):
         rc, out, err = module.run_command("%s -y install %s" % (APT_PATH, packages), environ_update={"LANG": "C"})
 
         installed = True
-        for packages in pkgspec:
+        for package in pkgspec:
             if not query_package_provides(module, package):
                 installed = False