Adding basic testing of VMs with test-bifrost.yaml
Added two roles and appropriate changes to test-bifrost.yaml in order to add the new hosts, typically which should be a single virtual machine, to the running inventory, and then connect to them and verify that the hostname is NOT ubuntu. This is in support of issue #4.
This commit is contained in:
parent
ee0f8a067c
commit
fe05724902
38
roles/bifrost-prepare-for-test/README.md
Normal file
38
roles/bifrost-prepare-for-test/README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
2
roles/bifrost-prepare-for-test/defaults/main.yml
Normal file
2
roles/bifrost-prepare-for-test/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for bifrost-prepare-for-test
|
2
roles/bifrost-prepare-for-test/handlers/main.yml
Normal file
2
roles/bifrost-prepare-for-test/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for bifrost-prepare-for-test
|
116
roles/bifrost-prepare-for-test/meta/main.yml
Normal file
116
roles/bifrost-prepare-for-test/meta/main.yml
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: Ironic Developers
|
||||||
|
description: Prepare for basic bifrost testing.
|
||||||
|
company: OpenStack
|
||||||
|
license: Apache
|
||||||
|
min_ansible_version: 1.9
|
||||||
|
#
|
||||||
|
# Below are all platforms currently available. Just uncomment
|
||||||
|
# the ones that apply to your role. If you don't see your
|
||||||
|
# platform on this list, let us know and we'll get it added!
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
#- name: EL
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 5
|
||||||
|
# - 6
|
||||||
|
# - 7
|
||||||
|
#- name: GenericUNIX
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 16
|
||||||
|
# - 17
|
||||||
|
# - 18
|
||||||
|
# - 19
|
||||||
|
# - 20
|
||||||
|
#- name: SmartOS
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: opensuse
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 12.1
|
||||||
|
# - 12.2
|
||||||
|
# - 12.3
|
||||||
|
# - 13.1
|
||||||
|
# - 13.2
|
||||||
|
#- name: Amazon
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 2013.03
|
||||||
|
# - 2013.09
|
||||||
|
#- name: GenericBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: FreeBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 8.0
|
||||||
|
# - 8.1
|
||||||
|
# - 8.2
|
||||||
|
# - 8.3
|
||||||
|
# - 8.4
|
||||||
|
# - 9.0
|
||||||
|
# - 9.1
|
||||||
|
# - 9.1
|
||||||
|
# - 9.2
|
||||||
|
#- name: Ubuntu
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - lucid
|
||||||
|
# - maverick
|
||||||
|
# - natty
|
||||||
|
# - oneiric
|
||||||
|
# - precise
|
||||||
|
# - quantal
|
||||||
|
# - raring
|
||||||
|
# - saucy
|
||||||
|
- trusty
|
||||||
|
#- name: SLES
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 10SP3
|
||||||
|
# - 10SP4
|
||||||
|
# - 11
|
||||||
|
# - 11SP1
|
||||||
|
# - 11SP2
|
||||||
|
# - 11SP3
|
||||||
|
#- name: GenericLinux
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Debian
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - etch
|
||||||
|
# - lenny
|
||||||
|
# - squeeze
|
||||||
|
# - wheezy
|
||||||
|
#
|
||||||
|
# Below are all categories currently available. Just as with
|
||||||
|
# the platforms above, uncomment those that apply to your role.
|
||||||
|
#
|
||||||
|
categories:
|
||||||
|
- cloud
|
||||||
|
- cloud:openstack
|
||||||
|
#- cloud:gce
|
||||||
|
#- cloud:rax
|
||||||
|
#- clustering
|
||||||
|
#- database
|
||||||
|
#- database:nosql
|
||||||
|
#- database:sql
|
||||||
|
#- development
|
||||||
|
#- monitoring
|
||||||
|
#- networking
|
||||||
|
#- packaging
|
||||||
|
#- system
|
||||||
|
#- web
|
||||||
|
dependencies: []
|
30
roles/bifrost-prepare-for-test/tasks/main.yml
Normal file
30
roles/bifrost-prepare-for-test/tasks/main.yml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# 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: "Waiting for the base testvm machine to become available."
|
||||||
|
wait_for: state=started port=22 host={{ item.split(',')[11] }} timeout=600
|
||||||
|
with_lines:
|
||||||
|
- cat {{ baremetal_csv_file }}
|
||||||
|
- name: "Adding testvms to Ansible Inventory"
|
||||||
|
add_host: name="{{ item.split(',')[11] }}:22" groups=testvm
|
||||||
|
with_lines:
|
||||||
|
- cat {{ baremetal_csv_file }}
|
||||||
|
- name: "Removing testvm hosts from ssh known_hosts file."
|
||||||
|
command: ssh-keygen -R "{{ item.split(',')[11] }}"
|
||||||
|
with_lines:
|
||||||
|
- cat {{ baremetal_csv_file }}
|
||||||
|
- name: "Adding testvm hosts from ssh known_hosts file."
|
||||||
|
shell: ssh-keyscan "{{ item.split(',')[11] }}" >> "{{ ansible_env.HOME }}/.ssh/known_hosts"
|
||||||
|
with_lines:
|
||||||
|
- cat {{ baremetal_csv_file }}
|
2
roles/bifrost-prepare-for-test/vars/main.yml
Normal file
2
roles/bifrost-prepare-for-test/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for bifrost-prepare-for-test
|
38
roles/bifrost-test-vm/README.md
Normal file
38
roles/bifrost-test-vm/README.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
Role Name
|
||||||
|
=========
|
||||||
|
|
||||||
|
A brief description of the role goes here.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
|
- hosts: servers
|
||||||
|
roles:
|
||||||
|
- { role: username.rolename, x: 42 }
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
BSD
|
||||||
|
|
||||||
|
Author Information
|
||||||
|
------------------
|
||||||
|
|
||||||
|
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
2
roles/bifrost-test-vm/defaults/main.yml
Normal file
2
roles/bifrost-test-vm/defaults/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# defaults file for bifrost-test-vm
|
2
roles/bifrost-test-vm/handlers/main.yml
Normal file
2
roles/bifrost-test-vm/handlers/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# handlers file for bifrost-test-vm
|
116
roles/bifrost-test-vm/meta/main.yml
Normal file
116
roles/bifrost-test-vm/meta/main.yml
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
---
|
||||||
|
galaxy_info:
|
||||||
|
author: Ironic Developers
|
||||||
|
description: Basic connectivity test.
|
||||||
|
company: OpenStack
|
||||||
|
license: Apache
|
||||||
|
min_ansible_version: 1.9
|
||||||
|
#
|
||||||
|
# Below are all platforms currently available. Just uncomment
|
||||||
|
# the ones that apply to your role. If you don't see your
|
||||||
|
# platform on this list, let us know and we'll get it added!
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
#- name: EL
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 5
|
||||||
|
# - 6
|
||||||
|
# - 7
|
||||||
|
#- name: GenericUNIX
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Fedora
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 16
|
||||||
|
# - 17
|
||||||
|
# - 18
|
||||||
|
# - 19
|
||||||
|
# - 20
|
||||||
|
#- name: SmartOS
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: opensuse
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 12.1
|
||||||
|
# - 12.2
|
||||||
|
# - 12.3
|
||||||
|
# - 13.1
|
||||||
|
# - 13.2
|
||||||
|
#- name: Amazon
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 2013.03
|
||||||
|
# - 2013.09
|
||||||
|
#- name: GenericBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: FreeBSD
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 8.0
|
||||||
|
# - 8.1
|
||||||
|
# - 8.2
|
||||||
|
# - 8.3
|
||||||
|
# - 8.4
|
||||||
|
# - 9.0
|
||||||
|
# - 9.1
|
||||||
|
# - 9.1
|
||||||
|
# - 9.2
|
||||||
|
#- name: Ubuntu
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - lucid
|
||||||
|
# - maverick
|
||||||
|
# - natty
|
||||||
|
# - oneiric
|
||||||
|
# - precise
|
||||||
|
# - quantal
|
||||||
|
# - raring
|
||||||
|
# - saucy
|
||||||
|
- trusty
|
||||||
|
#- name: SLES
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - 10SP3
|
||||||
|
# - 10SP4
|
||||||
|
# - 11
|
||||||
|
# - 11SP1
|
||||||
|
# - 11SP2
|
||||||
|
# - 11SP3
|
||||||
|
#- name: GenericLinux
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - any
|
||||||
|
#- name: Debian
|
||||||
|
# versions:
|
||||||
|
# - all
|
||||||
|
# - etch
|
||||||
|
# - lenny
|
||||||
|
# - squeeze
|
||||||
|
# - wheezy
|
||||||
|
#
|
||||||
|
# Below are all categories currently available. Just as with
|
||||||
|
# the platforms above, uncomment those that apply to your role.
|
||||||
|
#
|
||||||
|
categories:
|
||||||
|
- cloud
|
||||||
|
- cloud:openstack
|
||||||
|
#- cloud:gce
|
||||||
|
#- cloud:rax
|
||||||
|
#- clustering
|
||||||
|
#- database
|
||||||
|
#- database:nosql
|
||||||
|
#- database:sql
|
||||||
|
#- development
|
||||||
|
#- monitoring
|
||||||
|
#- networking
|
||||||
|
#- packaging
|
||||||
|
#- system
|
||||||
|
#- web
|
||||||
|
dependencies: []
|
22
roles/bifrost-test-vm/tasks/main.yml
Normal file
22
roles/bifrost-test-vm/tasks/main.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# 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: "Execute ping step to verify connectivity and login to the host. If this fails, the configdrive may not have loaded."
|
||||||
|
ping:
|
||||||
|
- name: 'Error if hostname is set to "ubuntu"'
|
||||||
|
# TODO: Presently this step is unable to cycle through each host and verify it's hostname is properly set.
|
||||||
|
# Perhaps if there was some way to extract the data on each host from Ironic's DB and then verify that information
|
||||||
|
# as a host-level fact that can be verified.
|
||||||
|
fail: msg='If this fails, the configdrive may not have been used as the hostname was set to the default "ubuntu"'
|
||||||
|
when: ansible_hostname == "ubuntu"
|
2
roles/bifrost-test-vm/vars/main.yml
Normal file
2
roles/bifrost-test-vm/vars/main.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
# vars file for bifrost-test-vm
|
@ -34,3 +34,13 @@
|
|||||||
roles:
|
roles:
|
||||||
- role: bifrost-configdrives
|
- role: bifrost-configdrives
|
||||||
- role: bifrost-setup-nodes
|
- role: bifrost-setup-nodes
|
||||||
|
- role: bifrost-prepare-for-test
|
||||||
|
# The testvm Host group is added by bifrost-prepare-for-test based
|
||||||
|
# on the contents of the CSV file.
|
||||||
|
- hosts: testvm
|
||||||
|
name: "Executes install, enrollment, and testing in one playbook"
|
||||||
|
sudo: no
|
||||||
|
gather_facts: yes
|
||||||
|
remote_user: ubuntu
|
||||||
|
roles:
|
||||||
|
- role: bifrost-test-vm
|
||||||
|
Loading…
Reference in New Issue
Block a user