Disable host_key_checking for testing

This is starting to become an issue, and since we are moving the
generation of ~/.ssh/known_hosts into windmill-ops, harder to deal with
SSH known hosts.  A future patch may dynamically generate our inventory
file, especially if we move to more multinode testing.

Change-Id: Id94228b20379decc4145701d0cb8d57791d1190c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-03-14 13:50:09 -04:00
parent e467267dd2
commit 0399fce301
2 changed files with 9 additions and 38 deletions

View File

@ -1,33 +0,0 @@
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
---
- name: Bootstrap bastion node
hosts: bastion
pre_tasks:
- name: Create SSH keys (if missing)
command: ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ""
args:
creates: ~/.ssh/id_rsa
- name: Ensure SSH public key is authorized
authorized_key:
user: "{{ lookup('env', 'USER') }}"
key: "{{ lookup('file', lookup('env','HOME') + '/.ssh/id_rsa.pub') }}"
- name: Ensure remote SSH host keys are known
known_hosts:
name: "{{ hostvars[item].ansible_host }}"
key: "{{ lookup('pipe', 'ssh-keyscan -t rsa {{ hostvars[item].ansible_host }}') }}"
with_inventory_hostnames: all:!bastion

View File

@ -1,11 +1,6 @@
---
- hosts: all
tasks:
- name: Setup SSH host keys for ansible
args:
chdir: "{{ windmill_src_dir }}"
shell: "tox -evenv -- ansible-playbook -v -f1 tests/playbooks/bastion/site.yaml"
# TODO(pabelanger): Because we use ansible, to install ansible, we first
# need to run windmill-ops, like we do with the current launch-node.py
# script. However, limit it to only the bastion host.
@ -13,3 +8,12 @@
args:
chdir: "{{ zuul.projects['git.openstack.org/openstack/windmill-ops'].src_dir }}"
shell: "tox -evenv -- ansible-playbook -v -f1 playbooks/bootstrap/site.yaml --limit bastion"
# NOTE(pabelanger): In production, this is not needed as the previous
# playbooks will properly setup SSH host keys from the inventory file.
- name: Disable SSH hostkey checking
ini_file:
path: ~/.ansible.cfg
section: defaults
option: host_key_checking
value: false