Add supplemental node to inventory
Change-Id: Id431120ab8d84fe7c05b008c9b3b1be6e4dd4af4
This commit is contained in:
parent
b039c85e45
commit
a9ab51f8d5
|
@ -164,8 +164,6 @@ undercloud_container_cli: >-
|
|||
enable_tls_everywhere: true
|
||||
novajoin_connect_timeout: 60
|
||||
novajoin_read_timeout: 60
|
||||
# Set the FreeIPA server IP
|
||||
freeipa_internal_ip: "{{ external_network_cidr|nthhost(10) }}"
|
||||
freeipa_admin_password: fce95318204114530f31f885c9df588f
|
||||
|
||||
# Set node hostnames.
|
||||
|
@ -183,13 +181,8 @@ overcloud_cloud_name_ctlplane: "overcloud.ctlplane.{{ tripleo_domain }}"
|
|||
# Ensure that the FreeIPA server node is provisioned during deployment.
|
||||
deploy_supplemental_node: true
|
||||
supplemental_user: centos
|
||||
supplemental_node_ip: "{{ freeipa_internal_ip }}"
|
||||
supplemental_image_url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
|
||||
|
||||
# Define FreeIPA server as DNS server for under/overcloud.
|
||||
undercloud_undercloud_nameservers: ["{{ freeipa_internal_ip }}"]
|
||||
overcloud_dns_servers: ["{{ freeipa_internal_ip }}"]
|
||||
|
||||
undercloud_custom_env_files: "{{ working_dir }}/undercloud-parameter-defaults.yaml"
|
||||
undercloud_resource_registry_args:
|
||||
"OS::TripleO::Undercloud::Net::SoftwareConfig": "{{ undercloud_templates_path }}/net-config-undercloud.yaml"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# SSH key used to access the undercloud/overcloud machines.
|
||||
undercloud_key: "{{ local_working_dir }}/id_rsa_undercloud"
|
||||
overcloud_key: "{{ local_working_dir }}/id_rsa_overcloud"
|
||||
extra_node_key: ~/extranode-id_rsa
|
||||
# Default to 'undercloud' if the overcloud has not been deployed yet, or 'all'
|
||||
# in case we want to inventory all the hosts. For OpenStack provider case,
|
||||
# use the 'openstack' value.
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# 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.
|
||||
import json
|
||||
import sys
|
||||
|
||||
data = json.load(open(sys.argv[1] + '/instackenv.json'))
|
||||
|
||||
|
||||
def right_replace(source, target, substitute, times):
|
||||
return substitute.join(source.rsplit(target, times))
|
||||
|
||||
|
||||
for node in data['nodes']:
|
||||
if 'extra' in node['name']:
|
||||
node_name = node['name']
|
||||
# NOTE: `nodes` and `network_details` dictionaries
|
||||
# vary node name by swapping the final '-' for a '_'
|
||||
corrected_name = right_replace(node_name, '-', '_', 1)
|
||||
extra_node_networks = data['network_details'][
|
||||
corrected_name]['ips'].keys()
|
||||
for network in extra_node_networks:
|
||||
if 'private' in network:
|
||||
print(data['network_details'][
|
||||
corrected_name]['ips'][network][0]['addr'].strip())
|
|
@ -66,24 +66,36 @@
|
|||
set_fact:
|
||||
virthost_with_private_key: "{{ 'virthost' in groups and groups['virthost']|length>0 and hostvars[groups['virthost'][0]].ansible_private_key_file is defined }}"
|
||||
|
||||
# Add the supplemental to the in-memory inventory.
|
||||
- name: Add supplemental node vm to inventory
|
||||
add_host:
|
||||
name: supplemental
|
||||
groups: supplemental
|
||||
ansible_host: supplemental
|
||||
ansible_fqdn: supplemental
|
||||
ansible_user: '{{ supplemental_user }}'
|
||||
ansible_private_key_file: '{{ local_working_dir }}/id_rsa_supplemental'
|
||||
ansible_ssh_extra_args: '-F "{{ local_working_dir }}/ssh.config.ansible"'
|
||||
supplemental_node_ip: "{{ supplemental_node_ip }}"
|
||||
when: supplemental_node_ip is defined
|
||||
- when: inventory == 'extra_node'
|
||||
block:
|
||||
|
||||
- name: set_fact for supplemental ip
|
||||
set_fact:
|
||||
supplemental_node_ip: "{{ hostvars['supplemental'].supplemental_node_ip }}"
|
||||
cacheable: true
|
||||
when: hostvars['supplemental'] is defined and hostvars['supplemental'].supplemental_node_ip is defined
|
||||
- name: Get IP of extra node in OVB stack
|
||||
script: get_extra_node.py {{ working_dir }}
|
||||
args:
|
||||
executable: python3
|
||||
register: node_ip
|
||||
|
||||
- name: set_fact for supplemental ip
|
||||
set_fact:
|
||||
supplemental_node_ip: "{{ node_ip.stdout|replace('\n', '')|replace('\r', '')|trim }}"
|
||||
cacheable: true
|
||||
when: node_ip.stdout
|
||||
|
||||
- name: Show the supplemental ip
|
||||
debug: msg="Supplemental node IP = {{ supplemental_node_ip }}"
|
||||
when: supplemental_node_ip is defined
|
||||
|
||||
- name: Add supplemental node vm to inventory
|
||||
add_host:
|
||||
name: supplemental
|
||||
groups: supplemental
|
||||
ansible_host: supplemental
|
||||
ansible_fqdn: supplemental
|
||||
ansible_user: '{{ supplemental_user }}'
|
||||
ansible_private_key_file: '{{ extra_node_key }}'
|
||||
ansible_ssh_extra_args: '-F "{{ local_working_dir }}/ssh.config.ansible"'
|
||||
supplemental_node_ip: "{{ supplemental_node_ip }}"
|
||||
when: supplemental_node_ip is defined
|
||||
|
||||
# readd the undercloud to reset the ansible_ssh parameters set in quickstart
|
||||
- name: Add undercloud vm to inventory
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
when: hostvars['localhost'].ansible_user_dir is not defined
|
||||
|
||||
- include_tasks: inventory.yml
|
||||
when: inventory in ['multinode', 'all', 'undercloud']
|
||||
when: inventory in ['multinode', 'all', 'undercloud', 'extra_node']
|
||||
|
||||
- include_tasks: openstack.yml
|
||||
when: inventory == 'openstack'
|
||||
|
|
|
@ -43,10 +43,15 @@ Host undercloud
|
|||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
|
||||
{% if deploy_supplemental_node %}
|
||||
{% if deploy_supplemental_node|bool and supplemental_node_ip is defined %}
|
||||
Host supplemental
|
||||
Hostname {{ supplemental_node_ip }}
|
||||
{% if inventory == 'extra_node' %}
|
||||
IdentityFile {{ extra_node_key }}
|
||||
{% else %}
|
||||
ProxyCommand {{ supplemental_ssh_proxy_command }}
|
||||
IdentityFile {{ local_working_dir }}/id_rsa_supplemental
|
||||
{% endif %}
|
||||
User {{ supplemental_user }}
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
|
|
Loading…
Reference in New Issue