parent
015331518d
commit
b518aabf81
3 changed files with 22 additions and 4 deletions
|
@ -5,7 +5,6 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import pty
|
import pty
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
@ -20,7 +19,7 @@ from ansible.errors import AnsibleError, AnsibleParserError, AnsibleUndefinedVar
|
||||||
from ansible.executor.task_result import TaskResult
|
from ansible.executor.task_result import TaskResult
|
||||||
from ansible.executor.module_common import get_action_args_with_defaults
|
from ansible.executor.module_common import get_action_args_with_defaults
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
from ansible.module_utils.parsing.convert_bool import boolean
|
||||||
from ansible.module_utils.six import iteritems, string_types, binary_type
|
from ansible.module_utils.six import iteritems, binary_type
|
||||||
from ansible.module_utils.six.moves import xrange
|
from ansible.module_utils.six.moves import xrange
|
||||||
from ansible.module_utils._text import to_text, to_native
|
from ansible.module_utils._text import to_text, to_native
|
||||||
from ansible.module_utils.connection import write_to_file_descriptor
|
from ansible.module_utils.connection import write_to_file_descriptor
|
||||||
|
@ -480,8 +479,8 @@ class TaskExecutor:
|
||||||
if self._loop_eval_error is not None:
|
if self._loop_eval_error is not None:
|
||||||
raise self._loop_eval_error # pylint: disable=raising-bad-type
|
raise self._loop_eval_error # pylint: disable=raising-bad-type
|
||||||
|
|
||||||
# if we ran into an error while setting up the PlayContext, raise it now
|
# if we ran into an error while setting up the PlayContext, raise it now, unless is known issue with delegation
|
||||||
if context_validation_error is not None:
|
if context_validation_error is not None and not (self._task.delegate_to and isinstance(context_validation_error, AnsibleUndefinedVariable)):
|
||||||
raise context_validation_error # pylint: disable=raising-bad-type
|
raise context_validation_error # pylint: disable=raising-bad-type
|
||||||
|
|
||||||
# if this task is a TaskInclude, we just return now with a success code so the
|
# if this task is a TaskInclude, we just return now with a success code so the
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
- name: ensure we can use fact on delegated host for connection info
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: no
|
||||||
|
tasks:
|
||||||
|
- add_host: name=f31 bogus_user=notme ansible_connection=ssh ansible_host=4.2.2.2
|
||||||
|
|
||||||
|
- name: if not overriding with delegated host info, will not be unreachable
|
||||||
|
ping:
|
||||||
|
timeout: 5
|
||||||
|
delegate_to: f31
|
||||||
|
ignore_errors: true
|
||||||
|
ignore_unreachable: true
|
||||||
|
register: delping
|
||||||
|
|
||||||
|
- name: ensure that the expected happened
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- delping is failed
|
|
@ -74,3 +74,4 @@ ansible-playbook discovery_applied.yml -i inventory -v "$@"
|
||||||
ansible-playbook resolve_vars.yml -i inventory -v "$@"
|
ansible-playbook resolve_vars.yml -i inventory -v "$@"
|
||||||
ansible-playbook test_delegate_to_lookup_context.yml -i inventory -v "$@"
|
ansible-playbook test_delegate_to_lookup_context.yml -i inventory -v "$@"
|
||||||
ansible-playbook delegate_local_from_root.yml -i inventory -v "$@" -e 'ansible_user=root'
|
ansible-playbook delegate_local_from_root.yml -i inventory -v "$@" -e 'ansible_user=root'
|
||||||
|
ansible-playbook delegate_with_fact_from_delegate_host.yml "$@"
|
||||||
|
|
Loading…
Reference in a new issue