From: Zack Cerza Date: Fri, 17 Jul 2015 20:01:57 +0000 (-0600) Subject: Ansible: reconnect to remotes after playbook runs X-Git-Tag: 1.1.0~870^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F574%2Fhead;p=teuthology.git Ansible: reconnect to remotes after playbook runs To take advantage of the updated ssh_config shipped by the testnodes role Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 405eadfb..0d69667a 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -66,6 +66,10 @@ class Ansible(Task): again during teardown with a 'cleanup' var set to True. This will allow the playbook to clean up after itself, if the playbook supports this feature. + reconnect: If set to True (the default), then reconnect to hosts after + ansible-playbook completes. This is in case the playbook + makes changes to the SSH configuration, or user accounts - + we would want to reflect those changes immediately. Examples: @@ -240,6 +244,12 @@ class Ansible(Task): if status != 0: raise CommandFailedError(command, status) + if self.config.get('reconnect', True) is True: + remotes = self.cluster.remotes.keys() + log.debug("Reconnecting to %s", remotes) + for remote in remotes: + remote.reconnect() + def _build_args(self): """ Assemble the list of args to be executed