Merge "Modify overcloud-deploy to support multiple stacks"
This commit is contained in:
87
playbooks/multinode-multiple-overcloud.yml
Normal file
87
playbooks/multinode-multiple-overcloud.yml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
##########################
|
||||||
|
# Prepare for deployment #
|
||||||
|
##########################
|
||||||
|
|
||||||
|
# From tripleo-quickstart/playbooks
|
||||||
|
- import_playbook: quickstart.yml
|
||||||
|
- import_playbook: multinode-undercloud.yml
|
||||||
|
- import_playbook: multinode-overcloud-prep.yml
|
||||||
|
|
||||||
|
##################################
|
||||||
|
# Deploy First stack - overcloud #
|
||||||
|
##################################
|
||||||
|
|
||||||
|
- name: Deploy the first overcloud
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- overcloud-deploy
|
||||||
|
environment:
|
||||||
|
TRIPLEO_ROOT: "{{ lookup('env','TRIPLEO_ROOT') }}"
|
||||||
|
|
||||||
|
- name: Check the result of the deployment
|
||||||
|
hosts: localhost
|
||||||
|
tags:
|
||||||
|
- overcloud-deploy
|
||||||
|
tasks:
|
||||||
|
- name: ensure the deployment result has been read into memory
|
||||||
|
include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json"
|
||||||
|
|
||||||
|
# overcloud_deploy_result = ["failed", "passed"]
|
||||||
|
- name: did the deployment pass or fail?
|
||||||
|
debug: var=overcloud_deploy_result
|
||||||
|
failed_when: overcloud_deploy_result == "failed"
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
# Deploy Second stack - overcloud-two #
|
||||||
|
#######################################
|
||||||
|
|
||||||
|
- name: Deploy the second overcloud
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: false
|
||||||
|
vars:
|
||||||
|
stack_name: "overcloud-two"
|
||||||
|
overcloud_cloud_name: "{{ stack_name }}.localdomain"
|
||||||
|
overcloud_cloud_name_internal: "{{ stack_name }}.internalapi.localdomain"
|
||||||
|
overcloud_cloud_name_storage: "{{ stack_name }}.storage.localdomain"
|
||||||
|
overcloud_cloud_name_storage_management: "{{ stack_name }}.storagemgmt.localdomain"
|
||||||
|
overcloud_cloud_name_ctlplane: "{{ stack_name }}.ctlplane.localdomain"
|
||||||
|
roles:
|
||||||
|
- overcloud-deploy
|
||||||
|
environment:
|
||||||
|
TRIPLEO_ROOT: "{{ lookup('env','TRIPLEO_ROOT') }}"
|
||||||
|
|
||||||
|
- name: Check the result of the deployment for overcloud-two
|
||||||
|
hosts: localhost
|
||||||
|
tags:
|
||||||
|
- overcloud-deploy
|
||||||
|
tasks:
|
||||||
|
- name: ensure the deployment result has been read into memory
|
||||||
|
include_vars: "{{ local_working_dir }}/overcloud_deployment_result.json"
|
||||||
|
|
||||||
|
# overcloud_deploy_result = ["failed", "passed"]
|
||||||
|
- name: did the deployment pass or fail?
|
||||||
|
debug: var=overcloud_deploy_result
|
||||||
|
failed_when: overcloud_deploy_result == "failed"
|
||||||
|
|
||||||
|
- name: Run tripleo-validations post-deployment tests
|
||||||
|
hosts: undercloud
|
||||||
|
gather_facts: false
|
||||||
|
tags:
|
||||||
|
- tripleo-validations
|
||||||
|
vars:
|
||||||
|
validations_group: ['post-deployment']
|
||||||
|
roles:
|
||||||
|
- {role: tripleo-validations,
|
||||||
|
when: run_tripleo_validations|bool or run_tripleo_validations_negative_tests|bool}
|
||||||
|
|
||||||
|
######################################
|
||||||
|
# Run tempest on overcloud-two stack #
|
||||||
|
######################################
|
||||||
|
|
||||||
|
# From tripleo-quickstart/playbooks
|
||||||
|
- import_playbook: multinode-validate.yml
|
||||||
|
vars:
|
||||||
|
tempest_cloud_name: 'overcloud-two'
|
@@ -1,12 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Script and log locations used during the deploy process.
|
# Script and log locations used during the deploy process.
|
||||||
|
stack_name: "overcloud"
|
||||||
deploy_script: overcloud-deploy.sh.j2
|
deploy_script: overcloud-deploy.sh.j2
|
||||||
deploy_cell_script: overcloud-deploy-cell.sh.j2
|
deploy_cell_script: overcloud-deploy-cell.sh.j2
|
||||||
deploy_log: "{{ working_dir }}/overcloud_deploy.log"
|
deploy_log: "{{ working_dir }}/{{ stack_name }}_deploy.log"
|
||||||
deploy_cell_log: "{{ working_dir }}/cell_deploy.log"
|
deploy_cell_log: "{{ working_dir }}/cell_deploy.log"
|
||||||
post_deploy_script: overcloud-deploy-post.sh.j2
|
post_deploy_script: overcloud-deploy-post.sh.j2
|
||||||
post_deploy_log: "{{ working_dir }}/overcloud_deploy_post.log"
|
post_deploy_log: "{{ working_dir }}/{{ stack_name }}_deploy_post.log"
|
||||||
failed_deployments_log: "{{ working_dir }}/failed_deployments.log"
|
failed_deployments_log: "{{ working_dir }}/failed_deployments.log"
|
||||||
failed_deployment_list: "{{ working_dir }}/failed_deployment_list.log"
|
failed_deployment_list: "{{ working_dir }}/failed_deployment_list.log"
|
||||||
failed_cell_deployment_list: "{{ working_dir }}/failed_cell_deployment_list.log"
|
failed_cell_deployment_list: "{{ working_dir }}/failed_cell_deployment_list.log"
|
||||||
|
@@ -20,13 +20,13 @@
|
|||||||
- name: Create overcloud deploy script
|
- name: Create overcloud deploy script
|
||||||
template:
|
template:
|
||||||
src: "{{ deploy_script }}"
|
src: "{{ deploy_script }}"
|
||||||
dest: "{{ working_dir }}/overcloud-deploy.sh"
|
dest: "{{ working_dir }}/{{ stack_name }}-deploy.sh"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Create post-deploy script
|
- name: Create post-deploy script
|
||||||
template:
|
template:
|
||||||
src: "{{ post_deploy_script }}"
|
src: "{{ post_deploy_script }}"
|
||||||
dest: "{{ working_dir }}/overcloud-deploy-post.sh"
|
dest: "{{ working_dir }}/{{ stack_name }}-deploy-post.sh"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
|
||||||
- name: Copy neutron l3 ha heat template
|
- name: Copy neutron l3 ha heat template
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
- name: Deploy the overcloud
|
- name: Deploy the overcloud
|
||||||
shell: >
|
shell: >
|
||||||
set -o pipefail &&
|
set -o pipefail &&
|
||||||
{{ working_dir }}/overcloud-deploy.sh 2>&1 {{ timestamper_cmd }} > {{ deploy_log }}
|
{{ working_dir }}/{{ stack_name }}-deploy.sh 2>&1 {{ timestamper_cmd }} > {{ deploy_log }}
|
||||||
register: deploy_script_result
|
register: deploy_script_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
when: step_deploy_overcloud|bool
|
when: step_deploy_overcloud|bool
|
||||||
|
@@ -5,12 +5,12 @@
|
|||||||
- name: Copy overcloudrc to ansible host
|
- name: Copy overcloudrc to ansible host
|
||||||
fetch:
|
fetch:
|
||||||
flat: true
|
flat: true
|
||||||
src: overcloudrc
|
src: "{{ stack_name }}rc"
|
||||||
dest: "{{ local_working_dir }}/overcloudrc"
|
dest: "{{ local_working_dir }}/{{ stack_name }}rc"
|
||||||
|
|
||||||
- name: Run post-deploy script
|
- name: Run post-deploy script
|
||||||
shell: >
|
shell: >
|
||||||
set -o pipefail &&
|
set -o pipefail &&
|
||||||
{{ working_dir }}/overcloud-deploy-post.sh 2>&1 {{ timestamper_cmd }} >
|
{{ working_dir }}/{{ stack_name }}-deploy-post.sh 2>&1 {{ timestamper_cmd }} >
|
||||||
{{ post_deploy_log }}
|
{{ post_deploy_log }}
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
@@ -29,10 +29,10 @@ sudo sed -i '/^## BEGIN OVERCLOUD HOSTS/,/^## END OVERCLOUD HOSTS/ d' $HOSTFILE
|
|||||||
|
|
||||||
cat <<EOF | sudo tee -a $HOSTFILE
|
cat <<EOF | sudo tee -a $HOSTFILE
|
||||||
## BEGIN OVERCLOUD HOSTS #nodocs
|
## BEGIN OVERCLOUD HOSTS #nodocs
|
||||||
$(openstack stack output show overcloud HostsEntry -f value -c output_value)
|
$(openstack stack output show {{ stack_name }} HostsEntry -f value -c output_value)
|
||||||
|
|
||||||
{% if enable_pacemaker|bool and release == 'mitaka' %}
|
{% if enable_pacemaker|bool and release == 'mitaka' %}
|
||||||
$(openstack stack output show overcloud PublicVip \
|
$(openstack stack output show {{ stack_name }} PublicVip \
|
||||||
-f value -c output_value) overcloud-public-vip
|
-f value -c output_value) overcloud-public-vip
|
||||||
{% endif %}
|
{% endif %}
|
||||||
## END OVERCLOUD HOSTS #nodocs
|
## END OVERCLOUD HOSTS #nodocs
|
||||||
@@ -42,13 +42,13 @@ EOF
|
|||||||
## * Create the `heat_stack_owner` role if it doesn't already exist.
|
## * Create the `heat_stack_owner` role if it doesn't already exist.
|
||||||
## ::
|
## ::
|
||||||
|
|
||||||
if openstack stack output show overcloud EnabledServices \
|
if openstack stack output show {{ stack_name }} EnabledServices \
|
||||||
-f value -c output_value | grep -q keystone; then
|
-f value -c output_value | grep -q keystone; then
|
||||||
|
|
||||||
## * Source in the overcloud credentials.
|
## * Source in the {{ stack_name }} credentials.
|
||||||
## ::
|
## ::
|
||||||
|
|
||||||
. {{ working_dir }}/overcloudrc
|
. {{ working_dir }}/{{ stack_name }}rc
|
||||||
|
|
||||||
if ! openstack role show heat_stack_owner > /dev/null 2>&1; then
|
if ! openstack role show heat_stack_owner > /dev/null 2>&1; then
|
||||||
openstack role create heat_stack_owner
|
openstack role create heat_stack_owner
|
||||||
|
@@ -31,7 +31,7 @@ done
|
|||||||
{% if baremetal_provision|bool %}
|
{% if baremetal_provision|bool %}
|
||||||
## * Provision the baremetal nodes
|
## * Provision the baremetal nodes
|
||||||
## ::
|
## ::
|
||||||
openstack overcloud node provision --stack overcloud --output {{ working_dir }}/overcloud-baremetal-deployed.yaml {{ working_dir }}/overcloud_baremetal_deploy.yaml
|
openstack overcloud node provision --stack {{ stack_name }} --output {{ working_dir }}/overcloud-baremetal-deployed.yaml {{ working_dir }}/overcloud_baremetal_deploy.yaml
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -39,7 +39,7 @@ fi
|
|||||||
|
|
||||||
## * Deploy the overcloud!
|
## * Deploy the overcloud!
|
||||||
## ::
|
## ::
|
||||||
openstack overcloud deploy {% if release is not in ['newton', 'ocata', 'pike', 'queens'] %}--override-ansible-cfg {{ working_dir }}/custom_ansible.cfg{% endif %} \
|
openstack overcloud deploy --stack {{ stack_name }} {% if release is not in ['newton', 'ocata', 'pike', 'queens'] %}--override-ansible-cfg {{ working_dir }}/custom_ansible.cfg{% endif %} \
|
||||||
--templates {{overcloud_templates_path}} \
|
--templates {{overcloud_templates_path}} \
|
||||||
{{ deploy_args | regex_replace("\n", " ") }} \
|
{{ deploy_args | regex_replace("\n", " ") }} \
|
||||||
"$@" && status_code=0 || status_code=$?
|
"$@" && status_code=0 || status_code=$?
|
||||||
@@ -47,7 +47,7 @@ openstack overcloud deploy {% if release is not in ['newton', 'ocata', 'pike', '
|
|||||||
### --stop_docs
|
### --stop_docs
|
||||||
|
|
||||||
# Check if the deployment has started. If not, exit gracefully. If yes, check for errors.
|
# Check if the deployment has started. If not, exit gracefully. If yes, check for errors.
|
||||||
if ! openstack stack list | grep -q overcloud; then
|
if ! openstack stack list | grep -q {{ stack_name }}; then
|
||||||
echo "overcloud deployment not started. Check the deploy configurations"
|
echo "overcloud deployment not started. Check the deploy configurations"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
@@ -57,12 +57,12 @@ if ! openstack stack list | grep -q overcloud; then
|
|||||||
elif ! openstack stack list | grep -Eq '(CREATE|UPDATE)_COMPLETE'; then
|
elif ! openstack stack list | grep -Eq '(CREATE|UPDATE)_COMPLETE'; then
|
||||||
{%if release not in ['mitaka', 'liberty'] %}
|
{%if release not in ['mitaka', 'liberty'] %}
|
||||||
# get the failures list
|
# get the failures list
|
||||||
openstack stack failures list overcloud --long > {{ failed_deployment_list }} || true
|
openstack stack failures list {{ stack_name }} --long > {{ failed_deployment_list }} || true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# get any puppet related errors
|
# get any puppet related errors
|
||||||
for failed in $(openstack stack resource list \
|
for failed in $(openstack stack resource list \
|
||||||
--nested-depth 5 overcloud | grep FAILED |
|
--nested-depth 5 {{ stack_name }} | grep FAILED |
|
||||||
grep 'StructuredDeployment ' | cut -d '|' -f3)
|
grep 'StructuredDeployment ' | cut -d '|' -f3)
|
||||||
do
|
do
|
||||||
echo "openstack software deployment show output for deployment: $failed" >> {{ failed_deployments_log }}
|
echo "openstack software deployment show output for deployment: $failed" >> {{ failed_deployments_log }}
|
||||||
@@ -80,9 +80,9 @@ elif ! openstack stack list | grep -Eq '(CREATE|UPDATE)_COMPLETE'; then
|
|||||||
done
|
done
|
||||||
exit 1
|
exit 1
|
||||||
{%if release in ['rocky', 'master'] %}
|
{%if release in ['rocky', 'master'] %}
|
||||||
elif ! openstack overcloud status | grep -Eq 'DEPLOY_SUCCESS'; then
|
elif ! openstack overcloud status --plan {{ stack_name }} | grep -Eq 'DEPLOY_SUCCESS'; then
|
||||||
# NOTE(emilien) "openstack overcloud failures" was introduced in Rocky
|
# NOTE(emilien) "openstack overcloud failures" was introduced in Rocky
|
||||||
openstack overcloud failures >> {{ failed_deployment_list }} || true
|
openstack overcloud failures --plan {{ stack_name }} >> {{ failed_deployment_list }} || true
|
||||||
{% endif %}
|
{% endif %}
|
||||||
fi
|
fi
|
||||||
exit $status_code
|
exit $status_code
|
||||||
|
Reference in New Issue
Block a user