bifrost/playbooks/roles/bifrost-configdrives/tasks/ssh_public_key_path.yaml
Julia Kreger 2c1c54d7b7 Fix playbooks for OpenStack CI
The OpenStack CI systems are preconfigured with various components
such as databases, message queues, caching dns resolvers.  The
CI systems also lack things like public/private key pairs, and
known_hosts files.

Due to this, a number of minor changes are required in Bifrost's test
sequence to account for and route around these differences in order
to allow test jobs to run until completion. This also demonstrated
that some steps have been operating under the assumption that the user
likely already had certain things installed, so service restart
tweeks have also been necessary.

Added a step to restart libvirt-bin in order to allow it to pickup
new capabilities due to the install of the qemu emulator.

Added additional steps to collect kernel log and `virsh capabilities`
output.

Removed MySQL step nolog statements as the password is automatically
suppressed and it suppresses information that could be required for
troubleshooting.

Added in specific username/password logic for MySQL steps if ZUUL
is detected in order to use the OpenStack CI defaults.

Changed VM test node creation to occur upon every attempt.

Extended the startup wait for a test node to be 900 seconds from 600
seconds.

Added collection of process list and listening sockets if ZUUL is
detected.

Added report of VM console log and various commands to assist in
troubleshooting a failing job.

Added auto-generation of a user ssh keypair if absent when operating
in OpenStack CI.

Added explicit adjustment of iptables to permit connections on the
network interface that the hosts are being provisioned via on
8080/tcp and 6385/tcp.

Change-Id: I3c37c5c21af0aefb5007c5775043f7f837389c2d
2015-05-16 06:18:48 +00:00

34 lines
1.8 KiB
YAML

# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: "Determine if OpenStack CI is missing an SSH key"
stat: path={{ssh_public_key_path}}
register: test_ssh_public_key_path
when: ci_testing_zuul is defined
- name: "Create an SSH key for Jenkins user if operating in OpenStack CI"
shell: ssh-keygen -f ~/.ssh/id_rsa -N ""
when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false
- name: "Create an empty ssh known_hosts file for Jenkins user if operating in OpenStack CI"
shell: touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false
- name: "Defined ssh_public_key_path - Check to see if there is a file where the ssh_public_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
register: test_ssh_public_key_path
when: ssh_public_key_path is defined
- name: "Defined ssh_public_key_path - Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
- name: "Defined ssh_public_key_path - Read ssh public key in"
set_fact: ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"