Merge "Add tripleo_nodes_validation role"
This commit is contained in:
commit
86669b56d9
|
@ -0,0 +1,6 @@
|
||||||
|
===============================
|
||||||
|
Role - tripleo_nodes_validation
|
||||||
|
===============================
|
||||||
|
|
||||||
|
.. ansibleautoplugin::
|
||||||
|
:role: tripleo_ansible/roles/tripleo_nodes_validation
|
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
# All variables intended for modification should be placed in this file.
|
||||||
|
|
||||||
|
# All variables within this role should have a prefix of "tripleo_nodes_validation"
|
||||||
|
tripleo_nodes_validation_debug: "{{ (ansible_verbosity | int) >= 2 | bool }}"
|
||||||
|
tripleo_nodes_validation_hide_sensitive_logs: true
|
||||||
|
tripleo_nodes_validation_ping_test_ips: []
|
||||||
|
tripleo_nodes_validation_tripleo_role_name: true
|
||||||
|
tripleo_nodes_validation_validate_controllers_icmp: true
|
||||||
|
tripleo_nodes_validation_validate_fqdn: false
|
||||||
|
tripleo_nodes_validation_validate_gateway_icmp: true
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
galaxy_info:
|
||||||
|
author: OpenStack
|
||||||
|
description: TripleO OpenStack Role -- tripleo_nodes_validation
|
||||||
|
company: Red Hat
|
||||||
|
license: Apache-2.0
|
||||||
|
min_ansible_version: 2.7
|
||||||
|
#
|
||||||
|
# Provide a list of supported platforms, and for each platform a list of versions.
|
||||||
|
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
|
||||||
|
# To view available platforms and versions (or releases), visit:
|
||||||
|
# https://galaxy.ansible.com/api/v1/platforms/
|
||||||
|
#
|
||||||
|
platforms:
|
||||||
|
- name: CentOS
|
||||||
|
versions:
|
||||||
|
- 7
|
||||||
|
- 8
|
||||||
|
|
||||||
|
galaxy_tags:
|
||||||
|
- tripleo
|
||||||
|
|
||||||
|
|
||||||
|
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||||
|
# if you add dependencies to this list.
|
||||||
|
dependencies: []
|
|
@ -0,0 +1,37 @@
|
||||||
|
# Molecule managed
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
{% if item.registry is defined %}
|
||||||
|
FROM {{ item.registry.url }}/{{ item.image }}
|
||||||
|
{% else %}
|
||||||
|
FROM {{ item.image }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||||
|
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install sudo python*-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
||||||
|
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||||
|
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
||||||
|
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
||||||
|
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
||||||
|
|
||||||
|
{% for pkg in item.easy_install | default([]) %}
|
||||||
|
# install pip for centos where there is no python-pip rpm in default repos
|
||||||
|
RUN easy_install {{ pkg }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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: Converge
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: "tripleo_nodes_validation"
|
|
@ -0,0 +1,50 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: podman
|
||||||
|
|
||||||
|
log: true
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: centos7
|
||||||
|
hostname: centos7
|
||||||
|
image: centos:7
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
pkg_extras: python-setuptools
|
||||||
|
volumes:
|
||||||
|
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||||
|
easy_install:
|
||||||
|
- pip
|
||||||
|
environment: &env
|
||||||
|
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||||
|
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||||
|
ulimits: &ulimit
|
||||||
|
- host
|
||||||
|
|
||||||
|
- name: centos8
|
||||||
|
hostname: centos8
|
||||||
|
image: centos:8
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
pkg_extras: python*-setuptools
|
||||||
|
volumes:
|
||||||
|
- /etc/ci/mirror_info.sh:/etc/ci/mirror_info.sh:ro
|
||||||
|
environment:
|
||||||
|
<<: *env
|
||||||
|
ulimits: *ulimit
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
log: true
|
||||||
|
env:
|
||||||
|
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||||
|
|
||||||
|
scenario:
|
||||||
|
test_sequence:
|
||||||
|
- destroy
|
||||||
|
- create
|
||||||
|
- prepare
|
||||||
|
- converge
|
||||||
|
- check
|
||||||
|
- destroy
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
|
@ -0,0 +1,21 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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: Prepare
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: test_deps
|
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
# Copyright 2020 Red Hat, Inc.
|
||||||
|
# All Rights Reserved.
|
||||||
|
#
|
||||||
|
# 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: Collect Network Facts
|
||||||
|
setup:
|
||||||
|
gather_subset:
|
||||||
|
- '!all'
|
||||||
|
- '!any'
|
||||||
|
- network
|
||||||
|
|
||||||
|
- name: Check Default IPv4 Gateway availability
|
||||||
|
command: "ping -w 10 -c 1 {{ ansible_facts.default_ipv4.gateway }}"
|
||||||
|
retries: 10
|
||||||
|
delay: 60
|
||||||
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- tripleo_nodes_validation_validate_gateway_icmp|bool
|
||||||
|
- ansible_facts.default_ipv4 is defined
|
||||||
|
- ansible_facts.default_ipv4.gateway is defined
|
||||||
|
|
||||||
|
- name: Check Controllers availability
|
||||||
|
command: "{{ (':' in controller) | ternary('ping6', 'ping') }} -w 10 -c 1 {{ controller }}"
|
||||||
|
retries: 10
|
||||||
|
delay: 60
|
||||||
|
loop_control:
|
||||||
|
loop_var: controller
|
||||||
|
loop: "{{ tripleo_nodes_validation_ping_test_ips }}"
|
||||||
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- tripleo_nodes_validation_validate_controllers_icmp|bool
|
||||||
|
- tripleo_nodes_validation_ping_test_ips | length > 0
|
||||||
|
|
||||||
|
- name: Verify the configured FQDN vs /etc/hosts
|
||||||
|
shell: |
|
||||||
|
HOSTNAME=$(hostname)
|
||||||
|
SHORT_NAME=$(hostname -s)
|
||||||
|
FQDN_FROM_HOSTS=$(awk '$3 == "'${SHORT_NAME}'"{print $2}' /etc/hosts)
|
||||||
|
if [[ $HOSTNAME != $FQDN_FROM_HOSTS ]]; then
|
||||||
|
echo "FAILURE"
|
||||||
|
echo -e "System hostname: ${HOSTNAME}\nEntry from /etc/hosts: ${FQDN_FROM_HOSTS}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- tripleo_nodes_validation_validate_fqdn|bool
|
|
@ -32,6 +32,7 @@
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
||||||
|
- tripleo-ansible-centos-8-molecule-tripleo_nodes_validation
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
||||||
|
@ -82,6 +83,7 @@
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
||||||
|
- tripleo-ansible-centos-8-molecule-tripleo_nodes_validation
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
||||||
|
@ -132,6 +134,7 @@
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
- tripleo-ansible-centos-8-molecule-tripleo_keystone_resources
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
- tripleo-ansible-centos-8-molecule-tripleo_module_load
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
- tripleo-ansible-centos-8-molecule-tripleo_network_config
|
||||||
|
- tripleo-ansible-centos-8-molecule-tripleo_nodes_validation
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
- tripleo-ansible-centos-8-molecule-tripleo_nova_image_cache
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
- tripleo-ansible-centos-8-molecule-tripleo_nvdimm
|
||||||
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
- tripleo-ansible-centos-8-molecule-tripleo_ovs_dpdk
|
||||||
|
@ -361,6 +364,13 @@
|
||||||
parent: tripleo-ansible-centos-8-base
|
parent: tripleo-ansible-centos-8-base
|
||||||
vars:
|
vars:
|
||||||
tripleo_role_name: tripleo_network_config
|
tripleo_role_name: tripleo_network_config
|
||||||
|
- job:
|
||||||
|
files:
|
||||||
|
- ^tripleo_ansible/roles/tripleo_nodes_validation/.*
|
||||||
|
name: tripleo-ansible-centos-8-molecule-tripleo_nodes_validation
|
||||||
|
parent: tripleo-ansible-centos-8-base
|
||||||
|
vars:
|
||||||
|
tripleo_role_name: tripleo_nodes_validation
|
||||||
- job:
|
- job:
|
||||||
files:
|
files:
|
||||||
- ^tripleo_ansible/roles/tripleo_nova_image_cache/.*
|
- ^tripleo_ansible/roles/tripleo_nova_image_cache/.*
|
||||||
|
|
Loading…
Reference in New Issue