Network provision - overcloud net VIPs
Add cli playbook to provision overcloud network Virtual IPs and write out an environment file to use when deploying the stack. Related: blueprint network-data-v2-ports Change-Id: Ic7bec13372313e3c09766777e433c4a8eab9977d
This commit is contained in:
parent
29253dab6a
commit
e7a28f8b02
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
# Copyright 2021 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: Overcloud Virtual IPs Provision
|
||||
connection: "{{ (tripleo_target_host is defined) | ternary('ssh', 'local') }}"
|
||||
hosts: "{{ tripleo_target_host | default('localhost') }}"
|
||||
remote_user: "{{ tripleo_target_user | default(lookup('env', 'USER')) }}"
|
||||
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
|
||||
any_errors_fatal: true
|
||||
vars:
|
||||
overwrite: false
|
||||
pre_tasks:
|
||||
- fail:
|
||||
msg: stack_name is a required input
|
||||
when:
|
||||
- stack_name is undefined
|
||||
- fail:
|
||||
msg: vip_data_path is a required input
|
||||
when:
|
||||
- vip_data_path is undefined
|
||||
- fail:
|
||||
msg: vip_deployed_path is required input
|
||||
when:
|
||||
- vip_deployed_path is undefined
|
||||
- name: Check if Virtual IPs deployment file already exist
|
||||
stat:
|
||||
path: "{{ vip_deployed_path }}"
|
||||
register: stat_vip_deployed_path_file
|
||||
- fail:
|
||||
msg: "Output file {{ vip_deployed_path }} already exists"
|
||||
when:
|
||||
- stat_vip_deployed_path_file.stat.exists and not overwrite|bool
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Load Virtual IP data config from file
|
||||
set_fact:
|
||||
vip_data: "{{ lookup('file', vip_data_path) | from_yaml }}"
|
||||
when:
|
||||
- vip_data is undefined
|
||||
|
||||
- name: Create/Update Overcloud Virtual IPs
|
||||
tripleo_overcloud_network_vip_provision:
|
||||
vip_data: "{{ vip_data | default([]) }}"
|
||||
stack_name: "{{ stack_name | default('overcloud') }}"
|
||||
|
||||
- name: Populate Overcloud Virtual IPs environment
|
||||
tripleo_overcloud_network_vip_populate_environment:
|
||||
stack_name: "{{ stack_name | default('overcloud') }}"
|
||||
vip_data: "{{ vip_data | default([]) }}"
|
||||
register: vip_environment
|
||||
|
||||
- name: Write deployed Virtual IPs environment file
|
||||
copy:
|
||||
dest: "{{ vip_deployed_path }}"
|
||||
content: "{{ vip_environment.env | default({}) | to_nice_yaml(indent=2) }}"
|
Loading…
Reference in New Issue