[Queens] Add workflow to do cellv2 host discovery

When the compute bootstrap node gets blacklisted or deployment is
run with skip-deploy-identifier the discovery job in step_5
won't run and requires a manual post deploy/scale step.

This introduce a workflow to run the discovery via an ansible
playbook.

Change-Id: I54d42df162a6744806301d97bca5d94e5f380a2b
Related-Bug: #1831711
This commit is contained in:
Martin Schuppert 2019-09-19 10:54:19 +02:00
parent c597511a9a
commit 8fbc9ec014
2 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,21 @@
---
- hosts: nova_discovery_nodes
gather_facts: True
vars:
container_name: "{{ nova_host_discovery_container }}"
tasks:
- block:
- name: Check if discovery container exist
shell: docker ps | grep {{ container_name }}$
register: is_discovery_container_running
ignore_errors: True
- name: Set fact discover_hosts
set_fact:
discover_hosts: "{{ is_discovery_container_running.rc == 0 }}"
- name: Discovering nova hosts
command: docker exec {{ container_name }} nova-manage cell_v2 discover_hosts --by-service
become: true
changed_when: false
delegate_to: '{{ groups[''nova_discovery_nodes''][0] }}'
when:
- discover_hosts|bool

View File

@ -0,0 +1,53 @@
---
version: '2.0'
name: tripleo.nova.v1
description: TripleO nova workflows
workflows:
cellv2_discovery:
description: cellv2 host discovery
input:
- nova_host_discovery_ansible_playbook
- nova_host_discovery_container
- nova_host_discovery_service
- ansible_extra_env_variables:
ANSIBLE_HOST_KEY_CHECKING: 'False'
ANSIBLE_SSH_RETRIES: '3'
tags:
- tripleo-common-managed
tasks:
get_overcloud_stack_details:
publish:
nova_discovery_ips: <% env().get('service_ips', {}).get($.nova_host_discovery_service + '_ctlplane_node_ips', []) %>
on-success: enable_ssh_admin
enable_ssh_admin:
workflow: tripleo.access.v1.enable_ssh_admin
input:
ssh_servers: <% $.nova_discovery_ips %>
on-success: get_private_key
get_private_key:
action: tripleo.validations.get_privkey
publish:
private_key: <% task().result %>
on-success: discover_hosts
discover_hosts:
action: tripleo.ansible-playbook
input:
inventory:
nova_discovery_nodes:
hosts: <% $.nova_discovery_ips.toDict($, {}) %>
verbosity: 0
playbook: <% $.nova_host_discovery_ansible_playbook %>
remote_user: tripleo-admin
become: true
become_user: root
ssh_private_key: <% $.private_key %>
ssh_common_args: '-o StrictHostKeyChecking=no'
ssh_extra_args: '-o UserKnownHostsFile=/dev/null'
extra_env_variables: <% $.ansible_extra_env_variables %>
extra_vars:
nova_host_discovery_container: <% $.nova_host_discovery_container %>