Add validate-undercloud role to perform idempotency and simple verification

Change-Id: I9b11d4e6b9c253f4db05a0e6da49abb7f73128bf
This commit is contained in:
Gabriele Cerami 2016-12-13 21:28:40 +01:00
parent 2aa05a5bae
commit 25c7723f5e
4 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
undercloud_sanity_check_script: undercloud-sanity-check.sh.j2
undercloud_sanity_check_log: "{{ working_dir }}/undercloud_sanity_check.log"
undercloud_check_idempotency: false
undercloud_check_sanity: false
undercloud_reinstall_log: "{{ working_dir }}/undercloud_reinstall.log"

View File

@ -0,0 +1,2 @@
dependencies:
- extras-common

View File

@ -0,0 +1,23 @@
- name: Reinstall the undercloud to check idempotency
shell: |
{{ working_dir }}/undercloud-install.sh > \
{{ undercloud_reinstall_log }} 2>&1
when: undercloud_check_idempotency|bool
tags:
- undercloud-validate
- name: Create undercloud sanity check script
template:
src: "{{ undercloud_sanity_check_script }}"
dest: "{{ working_dir }}/undercloud-sanity-check.sh"
mode: 0755
tags:
- undercloud-scripts
- name: check undercloud sanity
shell: |
{{ working_dir }}/undercloud-sanity-check.sh > \
{{ undercloud_sanity_check_log }} 2>&1
when: undercloud_check_sanity|bool
tags:
- undercloud-validate

View File

@ -0,0 +1,39 @@
### --start_docs
## Validate the undercloud installation
## ====================================
## * Set the uri of TripleO UI based on SSL usage
## ::
{% set ui_uri = "https://%s" % undercloud_network_cidr|nthhost(2) if undercloud_generate_service_certificate|bool else "http://%s:3000" % undercloud_network_cidr|nthhost(1) %}
## * Specify the function to test UI
## ::
function ui_sanity_check {
if [ -f "/etc/httpd/conf.d/25-tripleo-ui.conf" ]; then
if ! curl {{ ui_uri }} 2>/dev/null | grep -q 'TripleO'; then
echo "ERROR: TripleO UI front page is not loading."
exit 1
fi
fi
}
## * Check the answers from each undercloud service
## ::
set -x
source {{ working_dir}}/stackrc
openstack user list
openstack catalog list
nova service-list
glance image-list
neutron subnet-list
neutron net-list
neutron agent-list
ironic node-list
openstack stack list
ui_sanity_check
set +x
### --stop_docs