### Summary

Ansible is running in a nightly CI, but recently we're seeing this exception popping up randonly:
```
2022-06-30 20:57:35,092 p=226 u=psap-ci-runner n=ansible | ERROR! Unexpected Exception, this is probably a bug: The object retrieved for localhost must be a MutableMapping but was a <class 'NoneType'>
2022-06-30 20:57:35,093 p=226 u=psap-ci-runner n=ansible | to see the full traceback, use -vvv
2022-06-30 20:57:35,094 p=226 u=psap-ci-runner n=ansible | the full traceback was:

Traceback (most recent call last):
  File "/opt/venv/bin/ansible-playbook", line 123, in <module>
    exit_code = cli.run()
  File "/opt/venv/lib/python3.9/site-packages/ansible/cli/playbook.py", line 128, in run
    results = pbex.run()
  File "/opt/venv/lib/python3.9/site-packages/ansible/executor/playbook_executor.py", line 169, in run
    result = self._tqm.run(play=play)
  File "/opt/venv/lib/python3.9/site-packages/ansible/executor/task_queue_manager.py", line 282, in run
    play_return = strategy.run(iterator, play_context)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/linear.py", line 326, in run
    results += self._wait_on_pending_results(iterator)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 810, in _wait_on_pending_results
    results = self._process_pending_results(iterator)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 133, in inner
    results = func(self, iterator, one_pass=one_pass, max_passes=max_passes, do_handlers=do_handlers)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 698, in _process_pending_results
    self._variable_manager.set_host_facts(target_host, result_item['ansible_facts'].copy())
  File "/opt/venv/lib/python3.9/site-packages/ansible/vars/manager.py", line 628, in set_host_facts
    raise TypeError('The object retrieved for {0} must be a MutableMapping but was'
TypeError: The object retrieved for localhost must be a MutableMapping but was a <class 'NoneType'>
```

It's certainly coming from [this part of the code](https://github.com/ansible/ansible/blob/b56d73796e85f162d50b4fcd5930035183032d4a/lib/ansible/vars/manager.py#L671):
```
            if not isinstance(host_cache, MutableMapping):
                raise TypeError('The object retrieved for {0} must be a MutableMapping but was'
                                ' a {1}'.format(host, type(host_cache)))
```

This always happens in the first tasks (but not the first), see the [playbook logs stored there](https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift-psap_ci-artifacts/404/pull-ci-openshift-psap-ci-artifacts-master-ods-jh-on-ocp/1542599037834760192/artifacts/jh-on-ocp/test/artifacts/001__sutest_rhods__deploy_ldap/_ansible.log).

### Issue Type

Bug Report

### Component Name

ansible-playbook

### Ansible Version

```console
# running from a nightly build container, installed with Pip with `ansible==2.9.*`

ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/opt/ci-artifacts/src/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib/python3.9/site-packages/ansible
  executable location = /opt/venv/bin/ansible
  python version = 3.9.7 (default, Sep 13 2021, 08:18:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
```


### 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

ANSIBLE_NOCOWS(/etc/ansible/ansible.cfg) = True
CACHE_PLUGIN(/etc/ansible/ansible.cfg) = yaml
CACHE_PLUGIN_CONNECTION(env: ANSIBLE_CACHE_PLUGIN_CONNECTION) = /logs/artifacts/ansible_facts
CACHE_PLUGIN_TIMEOUT(/etc/ansible/ansible.cfg) = 0
DEFAULT_CALLBACK_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/opt/ci-artifacts/src/callback_plugins']
DEFAULT_FORKS(/etc/ansible/ansible.cfg) = 20
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/inventory/hosts']
DEFAULT_LOG_PATH(env: ANSIBLE_LOG_PATH) = /logs/artifacts/000__/_ansible.log
DEFAULT_REMOTE_USER(/etc/ansible/ansible.cfg) = root
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = ['/opt/ci-artifacts/roles']
DEFAULT_STDOUT_CALLBACK(/etc/ansible/ansible.cfg) = human_log
DEFAULT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
ENABLE_TASK_DEBUGGER(/etc/ansible/ansible.cfg) = False
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/etc/ansible/ansible.cfg) = ['secrets.py', '.pyc', '.cfg', '.crt', '.ini']
INVENTORY_UNPARSED_IS_FAILED(/etc/ansible/ansible.cfg) = True
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
RETRY_FILES_SAVE_PATH(/etc/ansible/ansible.cfg) = /tmp/ansible-installer-retries
```


### OS / Environment

OpenShift / Red Hat UBI 8

### Steps to Reproduce

happens randomly

### Expected Results

The first steps of our playbooks (the `check_deps` role) are as follows, when Ansible doesn't crash. [Example](https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift-psap_ci-artifacts/404/pull-ci-openshift-psap-ci-artifacts-master-ods-jh-on-ocp/1542599037834760192/artifacts/jh-on-ocp/test/artifacts/000__sutest_rhods__deploy_ods/_ansible.log):

```
2022-06-30 20:57:34,290 p=225 u=psap-ci-runner n=ansible | ansible-playbook 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/opt/ci-artifacts/src/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib/python3.9/site-packages/ansible
  executable location = /opt/venv/bin/ansible-playbook
  python version = 3.9.7 (default, Sep 13 2021, 08:18:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
2022-06-30 20:57:34,290 p=225 u=psap-ci-runner n=ansible | Using /etc/ansible/ansible.cfg as config file
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'actionable', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'counter_enabled', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'debug', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'dense', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'dense', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'full_skip', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'human_log', as we already have a stdout callback.
2022-06-30 20:57:34,547 p=225 u=psap-ci-runner n=ansible | Skipping callback 'json', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'minimal', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'null', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'oneline', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'selective', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'skippy', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'stderr', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'unixy', as we already have a stdout callback.
2022-06-30 20:57:34,548 p=225 u=psap-ci-runner n=ansible | Skipping callback 'yaml', as we already have a stdout callback.
2022-06-30 20:57:34,549 p=225 u=psap-ci-runner n=ansible | PLAYBOOK: tmpa2h6yqh5 **********************************************************
2022-06-30 20:57:34,549 p=225 u=psap-ci-runner n=ansible | 1 plays in /opt/ci-artifacts/src/tmpa2h6yqh5
2022-06-30 20:57:34,551 p=225 u=psap-ci-runner n=ansible | PLAY [Run rhods_deploy_ods role] ***********************************************
2022-06-30 20:57:34,558 p=225 u=psap-ci-runner n=ansible | META: ran handlers
2022-06-30 20:57:34,563 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,598 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,598 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,598 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,598 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,599 p=225 u=psap-ci-runner n=ansible | roles/check_deps/tasks/main.yml:2
2022-06-30 20:57:34,599 p=225 u=psap-ci-runner n=ansible | TASK: check_deps : Fail if artifact_dir is not defined
2022-06-30 20:57:34,599 p=225 u=psap-ci-runner n=ansible | ==> SKIPPED | Conditional result was False
2022-06-30 20:57:34,599 p=225 u=psap-ci-runner n=ansible | when: artifact_dir is undefined
2022-06-30 20:57:34,601 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,630 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,630 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | roles/check_deps/tasks/main.yml:6
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | TASK: check_deps : Fail if artifact_extra_logs_dir is not defined
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | ==> SKIPPED | Conditional result was False
2022-06-30 20:57:34,631 p=225 u=psap-ci-runner n=ansible | when: artifact_extra_logs_dir is undefined
2022-06-30 20:57:34,634 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | roles/check_deps/tasks/main.yml:10
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible | TASK: check_deps : Create the artifact_extra_logs_dir directory
2022-06-30 20:57:35,093 p=225 u=psap-ci-runner n=ansible |   - path:	/logs/artifacts/000__sutest_rhods__deploy_ods
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - diff
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |     - before
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |       - path:	/logs/artifacts/000__sutest_rhods__deploy_ods
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |       - mode:	02755
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |     - after
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |       - path:	/logs/artifacts/000__sutest_rhods__deploy_ods
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |       - mode:	0755
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - uid:	1008050000
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - gid:	1008050000
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - owner:	1008050000
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - group:	1008050000
2022-06-30 20:57:35,094 p=225 u=psap-ci-runner n=ansible |   - mode:	0755
2022-06-30 20:57:35,095 p=225 u=psap-ci-runner n=ansible |   - state:	directory
2022-06-30 20:57:35,095 p=225 u=psap-ci-runner n=ansible |   - size:	85
2022-06-30 20:57:35,098 p=225 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:35,741 p=225 u=psap-ci-runner n=ansible | ---
```

### Actual Results

```console
https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift-psap_ci-artifacts/404/pull-ci-openshift-psap-ci-artifacts-master-ods-jh-on-ocp/1542599037834760192/artifacts/jh-on-ocp/test/artifacts/001__sutest_rhods__deploy_ldap/_ansible.log

2022-06-30 20:57:34,290 p=226 u=psap-ci-runner n=ansible | ansible-playbook 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/opt/ci-artifacts/src/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/venv/lib/python3.9/site-packages/ansible
  executable location = /opt/venv/bin/ansible-playbook
  python version = 3.9.7 (default, Sep 13 2021, 08:18:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
2022-06-30 20:57:34,290 p=226 u=psap-ci-runner n=ansible | Using /etc/ansible/ansible.cfg as config file
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'actionable', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'counter_enabled', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'debug', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'dense', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'dense', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'full_skip', as we already have a stdout callback.
2022-06-30 20:57:34,571 p=226 u=psap-ci-runner n=ansible | Skipping callback 'human_log', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'json', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'minimal', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'null', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'oneline', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'selective', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'skippy', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'stderr', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'unixy', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | Skipping callback 'yaml', as we already have a stdout callback.
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | PLAYBOOK: tmpyhukbfg0 **********************************************************
2022-06-30 20:57:34,572 p=226 u=psap-ci-runner n=ansible | 1 plays in /opt/ci-artifacts/src/tmpyhukbfg0
2022-06-30 20:57:34,575 p=226 u=psap-ci-runner n=ansible | PLAY [Run rhods_deploy_ldap role] **********************************************
2022-06-30 20:57:34,584 p=226 u=psap-ci-runner n=ansible | META: ran handlers
2022-06-30 20:57:34,588 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | roles/check_deps/tasks/main.yml:2
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | TASK: check_deps : Fail if artifact_dir is not defined
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | ==> SKIPPED | Conditional result was False
2022-06-30 20:57:34,623 p=226 u=psap-ci-runner n=ansible | when: artifact_dir is undefined
2022-06-30 20:57:34,626 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,658 p=226 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | ---
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | roles/check_deps/tasks/main.yml:6
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | TASK: check_deps : Fail if artifact_extra_logs_dir is not defined
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | ==> SKIPPED | Conditional result was False
2022-06-30 20:57:34,659 p=226 u=psap-ci-runner n=ansible | when: artifact_extra_logs_dir is undefined
2022-06-30 20:57:34,663 p=226 u=psap-ci-runner n=ansible | 
2022-06-30 20:57:35,092 p=226 u=psap-ci-runner n=ansible | ERROR! Unexpected Exception, this is probably a bug: The object retrieved for localhost must be a MutableMapping but was a <class 'NoneType'>
2022-06-30 20:57:35,093 p=226 u=psap-ci-runner n=ansible | to see the full traceback, use -vvv
2022-06-30 20:57:35,094 p=226 u=psap-ci-runner n=ansible | the full traceback was:

Traceback (most recent call last):
  File "/opt/venv/bin/ansible-playbook", line 123, in <module>
    exit_code = cli.run()
  File "/opt/venv/lib/python3.9/site-packages/ansible/cli/playbook.py", line 128, in run
    results = pbex.run()
  File "/opt/venv/lib/python3.9/site-packages/ansible/executor/playbook_executor.py", line 169, in run
    result = self._tqm.run(play=play)
  File "/opt/venv/lib/python3.9/site-packages/ansible/executor/task_queue_manager.py", line 282, in run
    play_return = strategy.run(iterator, play_context)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/linear.py", line 326, in run
    results += self._wait_on_pending_results(iterator)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 810, in _wait_on_pending_results
    results = self._process_pending_results(iterator)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 133, in inner
    results = func(self, iterator, one_pass=one_pass, max_passes=max_passes, do_handlers=do_handlers)
  File "/opt/venv/lib/python3.9/site-packages/ansible/plugins/strategy/__init__.py", line 698, in _process_pending_results
    self._variable_manager.set_host_facts(target_host, result_item['ansible_facts'].copy())
  File "/opt/venv/lib/python3.9/site-packages/ansible/vars/manager.py", line 628, in set_host_facts
    raise TypeError('The object retrieved for {0} must be a MutableMapping but was'
TypeError: The object retrieved for localhost must be a MutableMapping but was a <class 'NoneType'>
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
for key in self._plugin.keys():
            self._cache[key] = self._plugin.get(key)
    def __repr__(self):
        return to_text(self._cache)
    def __iter__(self):
        return iter(self.keys())
    def __len__(self):
        return len(self.keys())
    def _do_load_key(self, key):
        load = False
        if all([
            key not in self._cache,
            key not in self._retrieved,
            self._plugin_name != 'memory',
            self._plugin.contains(key),
        ]):
            load = True
        return load
    def __getitem__(self, key):
        if self._do_load_key(key):
            try:
                self._cache[key] = self._plugin.get(key)
            except KeyError:
                pass
            else:
                self._retrieved[key] = self._cache[key]
        return self._cache[key]
    def get(self, key, default=None):