Add --add-known-hosts to control host bootstrap

Provide the option to add hosts to the SSH known hosts file when running
control host bootstrap.

Story: 2001670
Task: 6716
Change-Id: I512a343f875ee95194ab4fa98872e349f5a6dc7b
This commit is contained in:
Alex-Welsh 2022-10-03 14:28:00 +01:00 committed by Pierre Riteau
parent d4ce41baa2
commit ce74a98b1d
2 changed files with 19 additions and 0 deletions

View File

@ -239,6 +239,13 @@ class ControlHostBootstrap(KayobeAnsibleMixin, KollaAnsibleMixin, VaultMixin,
exists.
"""
def get_parser(self, prog_name):
parser = super(ControlHostBootstrap, self).get_parser(prog_name)
group = parser.add_argument_group("Host Bootstrap")
group.add_argument("--add-known-hosts", action='store_true',
help="add SSH known hosts entries for each host")
return parser
def take_action(self, parsed_args):
self.app.LOG.debug("Bootstrapping Kayobe Ansible control host")
ansible.install_galaxy_roles(parsed_args)
@ -268,6 +275,11 @@ class ControlHostBootstrap(KayobeAnsibleMixin, KollaAnsibleMixin, VaultMixin,
self.run_kayobe_playbooks(parsed_args, playbooks,
ignore_limit=True)
if parsed_args.add_known_hosts:
self.app.LOG.debug("Adding to known_hosts")
playbooks = _build_playbook_list("ssh-known-host")
self.run_kayobe_playbooks(parsed_args, playbooks)
class ControlHostUpgrade(KayobeAnsibleMixin, VaultMixin, Command):
"""Upgrade the Kayobe control environment.

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds the ``--add-known-hosts`` option to control host bootstrap. This will add
SSH known hosts entries for each host. This should provide a way around
the issues described in `story 2001670
<https://storyboard.openstack.org/#!/story/2001670>`__.