Merge pull request #4851 from ryanpetrello/fix-host-key-checking

improve host key checking configurability

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2019-09-30 18:38:05 +00:00
committed by GitHub
5 changed files with 20 additions and 1 deletions

View File

@@ -298,6 +298,16 @@ register(
category_slug='jobs', category_slug='jobs',
) )
register(
'AWX_ISOLATED_HOST_KEY_CHECKING',
field_class=fields.BooleanField,
label=_('Isolated host key checking'),
help_text=_('When set to True, AWX will enforce strict host key checking for communication with isolated nodes.'),
category=_('Jobs'),
category_slug='jobs',
default=False
)
register( register(
'AWX_ISOLATED_KEY_GENERATION', 'AWX_ISOLATED_KEY_GENERATION',
field_class=fields.BooleanField, field_class=fields.BooleanField,

View File

@@ -44,7 +44,7 @@ class IsolatedManager(object):
def build_runner_params(self, hosts, verbosity=1): def build_runner_params(self, hosts, verbosity=1):
env = dict(os.environ.items()) env = dict(os.environ.items())
env['ANSIBLE_RETRY_FILES_ENABLED'] = 'False' env['ANSIBLE_RETRY_FILES_ENABLED'] = 'False'
env['ANSIBLE_HOST_KEY_CHECKING'] = 'False' env['ANSIBLE_HOST_KEY_CHECKING'] = str(settings.AWX_ISOLATED_HOST_KEY_CHECKING)
env['ANSIBLE_LIBRARY'] = os.path.join(os.path.dirname(awx.__file__), 'plugins', 'isolated') env['ANSIBLE_LIBRARY'] = os.path.join(os.path.dirname(awx.__file__), 'plugins', 'isolated')
set_pythonpath(os.path.join(settings.ANSIBLE_VENV_PATH, 'lib'), env) set_pythonpath(os.path.join(settings.ANSIBLE_VENV_PATH, 'lib'), env)

View File

@@ -33,6 +33,7 @@ class Command(BaseCommand):
]): ]):
ssh_key = settings.AWX_ISOLATED_PRIVATE_KEY ssh_key = settings.AWX_ISOLATED_PRIVATE_KEY
env = dict(os.environ.items()) env = dict(os.environ.items())
env['ANSIBLE_HOST_KEY_CHECKING'] = str(settings.AWX_ISOLATED_HOST_KEY_CHECKING)
set_pythonpath(os.path.join(settings.ANSIBLE_VENV_PATH, 'lib'), env) set_pythonpath(os.path.join(settings.ANSIBLE_VENV_PATH, 'lib'), env)
res = ansible_runner.interface.run( res = ansible_runner.interface.run(
private_data_dir=path, private_data_dir=path,

View File

@@ -403,6 +403,11 @@ EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = '' EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False EMAIL_USE_TLS = False
# Default to skipping isolated host key checking (the initial connection will
# hang on an interactive "The authenticity of host example.org can't be
# established" message)
AWX_ISOLATED_HOST_KEY_CHECKING = False
# The number of seconds to sleep between status checks for jobs running on isolated nodes # The number of seconds to sleep between status checks for jobs running on isolated nodes
AWX_ISOLATED_CHECK_INTERVAL = 30 AWX_ISOLATED_CHECK_INTERVAL = 30

View File

@@ -71,6 +71,9 @@ export default ['i18n', function(i18n) {
codeMirror: true, codeMirror: true,
class: 'Form-textAreaLabel Form-formGroup--fullWidth' class: 'Form-textAreaLabel Form-formGroup--fullWidth'
}, },
AWX_ISOLATED_HOST_KEY_CHECKING: {
type: 'toggleSwitch',
},
AWX_ISOLATED_CHECK_INTERVAL: { AWX_ISOLATED_CHECK_INTERVAL: {
type: 'text', type: 'text',
reset: 'AWX_ISOLATED_CHECK_INTERVAL' reset: 'AWX_ISOLATED_CHECK_INTERVAL'