mirror of
https://github.com/xcat2/confluent.git
synced 2026-11-24 11:22:24 +00:00
Keep ansible's default ssh_args when running plays
Setting ANSIBLE_SSH_ARGS replaces ansible's ssh_args instead of adding to them, so plays ran without the default ControlMaster and ControlPersist options. Every task then opened a new ssh connection and authenticated again. Start from ansible's default ssh_args when ANSIBLE_SSH_ARGS is not set. An ANSIBLE_SSH_ARGS from the environment is still extended as before.
This commit is contained in:
@@ -187,8 +187,11 @@ class PlayRunner(object):
|
||||
'w') as hostvarsout:
|
||||
json.dump(self.hostvars, hostvarsout, default=str)
|
||||
localenv['CONFLUENT_HOSTVARS'] = hostvarspath
|
||||
# ANSIBLE_SSH_ARGS replaces ansible's ssh_args, so start from
|
||||
# its defaults to keep ControlPersist
|
||||
ansiblesshargs = os.environ.get(
|
||||
'ANSIBLE_SSH_ARGS', '-C -o ControlMaster=auto -o ControlPersist=60s')
|
||||
# limit host based algorithms to avoid excessive authentication attempts
|
||||
ansiblesshargs = os.environ.get('ANSIBLE_SSH_ARGS', '')
|
||||
if 'hostbasedkeytypes' not in ansiblesshargs.lower() and 'hostbasedacceptedalgorithms' not in ansiblesshargs.lower():
|
||||
ansiblesshargs += ' -o HostbasedAcceptedAlgorithms=*ed25519*'
|
||||
# notice a node that was reset mid play, else ssh waits forever
|
||||
|
||||
Reference in New Issue
Block a user