### Summary

😄 Here is some description of my issue: https://github.com/kubernetes-sigs/kubespray/issues/9126#issuecomment-1210807498

when `run_once` and `loop` appear in the task at the same time, the value of `run_once` is a variable and the variable is `false`, and the expected result of the task does not take effect at this time.


### Issue Type

Bug Report

### Component Name

ansible-playbook,loop,run_once,register

### Ansible Version

```console
$ ansible --version
ansible [core 2.12.5]
  config file = /root/workspaces/kubespray/ansible.cfg
  configured module search path = ['/root/workspaces/kubespray/library']
  ansible python module location = /root/workspaces/kubespray/kubespray-venv/lib/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/workspaces/kubespray/kubespray-venv/bin/ansible
  python version = 3.9.10 (main, Aug  9 2022, 02:24:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
  jinja version = 2.11.3
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CACHE_PLUGIN(/root/workspaces/kubespray/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/root/workspaces/kubespray/ansible.cfg) = /tmp
CACHE_PLUGIN_TIMEOUT(/root/workspaces/kubespray/ansible.cfg) = 86400
CALLBACKS_ENABLED(/root/workspaces/kubespray/ansible.cfg) = ['profile_tasks', 'ara_default']
DEFAULT_GATHERING(/root/workspaces/kubespray/ansible.cfg) = smart
DEFAULT_MODULE_PATH(/root/workspaces/kubespray/ansible.cfg) = ['/root/workspaces/kubespray/library']
DEFAULT_ROLES_PATH(/root/workspaces/kubespray/ansible.cfg) = ['/root/workspaces/kubespray/roles', '/root/workspaces/kubespray/kubespray-venv/usr/local/share/k
DEFAULT_STDOUT_CALLBACK(/root/workspaces/kubespray/ansible.cfg) = default
DEPRECATION_WARNINGS(/root/workspaces/kubespray/ansible.cfg) = False
DISPLAY_SKIPPED_HOSTS(/root/workspaces/kubespray/ansible.cfg) = False
HOST_KEY_CHECKING(/root/workspaces/kubespray/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/root/workspaces/kubespray/ansible.cfg) = ['~', '.orig', '.bak', '.ini', '.cfg', '.retry', '.pyc', '.pyo', '.creds', '.gpg']
INVENTORY_IGNORE_PATTERNS(/root/workspaces/kubespray/ansible.cfg) = ['artifacts', 'credentials']
TRANSFORM_INVALID_GROUP_CHARS(/root/workspaces/kubespray/ansible.cfg) = ignore

BECOME:
======

CACHE:
=====

jsonfile:
________
_timeout(/root/workspaces/kubespray/ansible.cfg) = 86400
_uri(/root/workspaces/kubespray/ansible.cfg) = /tmp

CALLBACK:
========

default:
_______
display_skipped_hosts(/root/workspaces/kubespray/ansible.cfg) = False

CLICONF:
=======

CONNECTION:
==========

paramiko_ssh:
____________
host_key_checking(/root/workspaces/kubespray/ansible.cfg) = False

ssh:
___
host_key_checking(/root/workspaces/kubespray/ansible.cfg) = False
pipelining(/root/workspaces/kubespray/ansible.cfg) = True

HTTPAPI:
=======

INVENTORY:
=========

LOOKUP:
======

NETCONF:
=======

SHELL:
=====

VARS:
====
```


### OS / Environment

| node     | arch     | os     |
| -------- | -------- | -------- |
| master1  | x86_64   | CentOS Linux 7 (Core)    |
| worker1  | aarch64  | Kylin Linux Advanced Server V10 (Tercel)  |

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
---
- name: test run_once
  hosts: k8s_cluster
  gather_facts: False
  tags: always
  vars:
    test_flag: false
    os_release_path: /etc/os-release
  tasks:
    - name: Fetch /etc/os-release
      run_once: "{{ test_flag | bool }}"
      raw: "cat {{ path_var }}"
      register: os_release
      loop: "{{ [os_release_path] }}"
      loop_control:
        loop_var: path_var
    - name: Debug print var
      debug:
        msg: ">> os_release: {{ os_release }}"
```


### Expected Results

```
TASK [Fetch /etc/os-release] *********************************************************************************************************************************
changed: [worker1]
changed: [master1]
Wednesday 10 August 2022  10:49:58 -0400 (0:00:00.406)       0:00:00.457 ******

TASK [Debug print var] ***************************************************************************************************************************************
ok: [master1] => {
    "msg": ">> os_release: {'rc': 0, 'stdout': 'NAME=\"CentOS Linux\"\\r\\nVERSION=\"7 (Core)\"\\r\\nID=\"centos\"\\r\\nID_LIKE=\"rhel fedora\"\\r\\nVERSION_ID=\"7\"\\r\\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\\r\\nANSI_COLOR=\"0;31\"\\r\\nCPE_NAME=\"cpe:/o:centos:centos:7\"\\r\\nHOME_URL=\"https://www.centos.org/\"\\r\\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\\r\\n\\r\\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\\r\\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\\r\\nREDHAT_SUPPORT_PRODUCT=\"centos\"\\r\\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\\r\\n\\r\\n', 'stdout_lines': ['NAME=\"CentOS Linux\"', 'VERSION=\"7 (Core)\"', 'ID=\"centos\"', 'ID_LIKE=\"rhel fedora\"', 'VERSION_ID=\"7\"', 'PRETTY_NAME=\"CentOS Linux 7 (Core)\"', 'ANSI_COLOR=\"0;31\"', 'CPE_NAME=\"cpe:/o:centos:centos:7\"', 'HOME_URL=\"https://www.centos.org/\"', 'BUG_REPORT_URL=\"https://bugs.centos.org/\"', '', 'CENTOS_MANTISBT_PROJECT=\"CentOS-7\"', 'CENTOS_MANTISBT_PROJECT_VERSION=\"7\"', 'REDHAT_SUPPORT_PRODUCT=\"centos\"', 'REDHAT_SUPPORT_PRODUCT_VERSION=\"7\"', ''], 'stderr': 'Shared connection to 10.6.170.20 closed.\\r\\n', 'stderr_lines': ['Shared connection to 10.6.170.20 closed.'], 'changed': True, 'failed': False}"
}
ok: [worker1] => {
    "msg": ">> os_release: {'rc': 0, 'stdout': 'NAME=\"Kylin Linux Advanced Server\"\\r\\nVERSION=\"V10 (Tercel)\"\\r\\nID=\"kylin\"\\r\\nVERSION_ID=\"V10\"\\r\\nPRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"\\r\\nANSI_COLOR=\"0;31\"\\r\\n\\r\\n', 'stdout_lines': ['NAME=\"Kylin Linux Advanced Server\"', 'VERSION=\"V10 (Tercel)\"', 'ID=\"kylin\"', 'VERSION_ID=\"V10\"', 'PRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"', 'ANSI_COLOR=\"0;31\"', ''], 'stderr': '\\nAuthorized users only. All activities may be monitored and reported.\\nShared connection to 172.30.40.199 closed.\\r\\n', 'stderr_lines': ['', 'Authorized users only. All activities may be monitored and reported.', 'Shared connection to 172.30.40.199 closed.'], 'changed': True, 'failed': False}"
}
```

### Actual Results

```console
TASK [Fetch /etc/os-release] *********************************************************************************************************************************
changed: [master1] => (item=/etc/os-release)
changed: [worker1] => (item=/etc/os-release)
Wednesday 10 August 2022  10:47:57 -0400 (0:00:00.372)       0:00:00.429 ******

TASK [Debug print var] ***************************************************************************************************************************************
ok: [master1] => {
    "msg": ">> os_release: {'results': [{'rc': 0, 'stdout': 'NAME=\"Kylin Linux Advanced Server\"\\r\\nVERSION=\"V10 (Tercel)\"\\r\\nID=\"kylin\"\\r\\nVERSION_ID=\"V10\"\\r\\nPRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"\\r\\nANSI_COLOR=\"0;31\"\\r\\n\\r\\n', 'stdout_lines': ['NAME=\"Kylin Linux Advanced Server\"', 'VERSION=\"V10 (Tercel)\"', 'ID=\"kylin\"', 'VERSION_ID=\"V10\"', 'PRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"', 'ANSI_COLOR=\"0;31\"', ''], 'stderr': '\\nAuthorized users only. All activities may be monitored and reported.\\nShared connection to 172.30.40.199 closed.\\r\\n', 'stderr_lines': ['', 'Authorized users only. All activities may be monitored and reported.', 'Shared connection to 172.30.40.199 closed.'], 'changed': True, 'failed': False, 'path_var': '/etc/os-release', 'ansible_loop_var': 'path_var'}], 'skipped': False, 'changed': True, 'msg': 'All items completed'}"
}
ok: [worker1] => {
    "msg": ">> os_release: {'results': [{'rc': 0, 'stdout': 'NAME=\"Kylin Linux Advanced Server\"\\r\\nVERSION=\"V10 (Tercel)\"\\r\\nID=\"kylin\"\\r\\nVERSION_ID=\"V10\"\\r\\nPRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"\\r\\nANSI_COLOR=\"0;31\"\\r\\n\\r\\n', 'stdout_lines': ['NAME=\"Kylin Linux Advanced Server\"', 'VERSION=\"V10 (Tercel)\"', 'ID=\"kylin\"', 'VERSION_ID=\"V10\"', 'PRETTY_NAME=\"Kylin Linux Advanced Server V10 (Tercel)\"', 'ANSI_COLOR=\"0;31\"', ''], 'stderr': '\\nAuthorized users only. All activities may be monitored and reported.\\nShared connection to 172.30.40.199 closed.\\r\\n', 'stderr_lines': ['', 'Authorized users only. All activities may be monitored and reported.', 'Shared connection to 172.30.40.199 closed.'], 'changed': True, 'failed': False, 'path_var': '/etc/os-release', 'ansible_loop_var': 'path_var'}], 'skipped': False, 'changed': True, 'msg': 'All items completed'}"
}
```
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
#
#
#
#
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
    name: linear
    short_description: Executes tasks in a linear fashion
    description:
        - Task execution is in lockstep per host batch as defined by C(serial) (default all).
          Up to the fork limit of hosts will execute each task at the same time and then
          the next series of hosts until the batch is done, before going on to the next task.
    version_added: "2.0"
    notes:
     - This was the default Ansible behaviour before 'strategy plugins' were introduced in 2.0.
    author: Ansible Core Team
'''
from ansible import constants as C
from ansible.errors import AnsibleError, AnsibleAssertionError, AnsibleParserError
from ansible.executor.play_iterator import IteratingStates, FailedStates
from ansible.module_utils._text import to_text
from ansible.playbook.handler import Handler
from ansible.playbook.included_file import IncludedFile
from ansible.playbook.task import Task
from ansible.plugins.loader import action_loader
from ansible.plugins.strategy import StrategyBase
from ansible.template import Templar