]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Ansible: reconnect to remotes after playbook runs 574/head
authorZack Cerza <zack@redhat.com>
Fri, 17 Jul 2015 20:01:57 +0000 (14:01 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 17 Jul 2015 23:31:24 +0000 (17:31 -0600)
To take advantage of the updated ssh_config shipped by the testnodes
role

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/ansible.py

index 405eadfb22b93a99d3b6a1903611207dbfdd380d..0d69667a3fe82fee6779a6c98b05d2082b40f3b1 100644 (file)
@@ -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