Merge "Add role for tripleo_overcloud_network_provision"
This commit is contained in:
commit
d72f3c97ee
|
@ -0,0 +1,57 @@
|
||||||
|
tripleo_overcloud_network_provision
|
||||||
|
=========
|
||||||
|
|
||||||
|
A role to perform overcloud network provisioning.
|
||||||
|
|
||||||
|
Requirements
|
||||||
|
------------
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
Role Variables
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* `tripleo_overcloud_network_provision_debug`: (Boolean) Flag to print out the delete command. Default: False
|
||||||
|
* `tripleo_overcloud_network_provision_deployment_file`: (String) REQUIRED. File path to the deployment file describing the networks.
|
||||||
|
* `tripleo_overcloud_network_provision_generate_scripts`: (Boolean) Write out a shell script that can be used to reproduce the command being executed. By default uses the value of `tripleo_generate_scripts` or False if `tripleo_generate_scripts` is not defined.
|
||||||
|
* `tripleo_overcloud_network_provision_generate_scripts_only`: (Boolean) Do not run the actual command - to be used in conjunction with `tripleo_overcloud_network_provision_generate_scripts`. By default uses the value of `tripleo_generate_scripts_only` or False if `tripleo_generate_scripts_only` is not defined.
|
||||||
|
* `tripleo_overcloud_network_provision_home_dir`: (String) Home directory to where the command is run from. Default: "{{ ansible_env.HOME }}"
|
||||||
|
* `tripleo_overcloud_network_provision_log_combine`: (Boolean) Flag to enable capturing stderr with stdout. Default: true
|
||||||
|
* `tripleo_overcloud_network_provision_log_output`: (Boolean) Flag to enable logging to a file. Since the output of this command can be large, it is not recommended to disable this. Default: true
|
||||||
|
* `tripleo_overcloud_network_provision_log`: (String) Path to a log file for the command output. Default: "{{ tripleo_overcloud_network_provision_home_dir }}/overcloud_network_provision.log"
|
||||||
|
* `tripleo_overcloud_network_provision_os_cloud`: (String) (String) OS_CLOUD value to use when running the command. If `tripleo_os_cloud` is defined, it will be the default. Otherwise the default is ''. This variable takes precedence over `tripleo_overcloud_network_provision_rc_file`.
|
||||||
|
* `tripleo_overcloud_network_provision_output_file`: (String) Path to an output file.
|
||||||
|
* `tripleo_overcloud_network_provision_rc_file`: (String) (String) Path to the credential file to use. If `tripleo_rc_file` is defined, it will be the default. Default: "{{ ansible_env.HOME }}/stackrc"
|
||||||
|
|
||||||
|
Output Variables
|
||||||
|
----------------
|
||||||
|
|
||||||
|
* `tripleo_overcloud_network_provision_output`: (String) The command standard output.
|
||||||
|
* `tripleo_overcloud_network_provision_result`: Ansible shell execution results
|
||||||
|
|
||||||
|
Dependencies
|
||||||
|
------------
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
Example Playbook
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Example network provisioning
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- hosts: undercloud
|
||||||
|
gather_facts: true
|
||||||
|
tasks:
|
||||||
|
- name: Run overcloud network provision
|
||||||
|
import_role:
|
||||||
|
name: tripleo_overcloud_network_provision
|
||||||
|
var:
|
||||||
|
tripleo_overcloud_network_provision_debug: true
|
||||||
|
tripleo_overcloud_network_provision_deployment_file: /home/stack/network-data.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
License
|
||||||
|
-------
|
||||||
|
|
||||||
|
Apache-2.0
|
|
@ -0,0 +1,14 @@
|
||||||
|
# defaults file for tripleo_overcloud_network_provision
|
||||||
|
---
|
||||||
|
openstack_bin: openstack
|
||||||
|
tripleo_overcloud_network_provision_debug: false
|
||||||
|
tripleo_overcloud_network_provision_deployment_file:
|
||||||
|
tripleo_overcloud_network_provision_generate_scripts: "{{ tripleo_generate_scripts | default(False) }}"
|
||||||
|
tripleo_overcloud_network_provision_generate_scripts_only: "{{ tripleo_generate_scripts_only | default(False) }}"
|
||||||
|
tripleo_overcloud_network_provision_home_dir: "{{ ansible_env.HOME }}"
|
||||||
|
tripleo_overcloud_network_provision_log: "{{ tripleo_overcloud_network_provision_home_dir }}/overcloud_network_provision.log"
|
||||||
|
tripleo_overcloud_network_provision_log_combine: true
|
||||||
|
tripleo_overcloud_network_provision_log_output: true
|
||||||
|
tripleo_overcloud_network_provision_os_cloud: "{{ tripleo_os_cloud | default('') }}"
|
||||||
|
tripleo_overcloud_network_provision_output_file:
|
||||||
|
tripleo_overcloud_network_provision_rc_file: "{{ tripleo_rc_file | default(ansible_env.HOME ~ '/stackrc') }}"
|
|
@ -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 Operator Role -- tripleo_overcloud_network_provision
|
||||||
|
company: Red Hat
|
||||||
|
license: Apache-2.0
|
||||||
|
min_ansible_version: 2.8
|
||||||
|
#
|
||||||
|
# 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,44 @@
|
||||||
|
---
|
||||||
|
- name: Converge
|
||||||
|
hosts: all
|
||||||
|
collections:
|
||||||
|
- tripleo.operator
|
||||||
|
vars:
|
||||||
|
openstack_bin: echo
|
||||||
|
tripleo_os_cloud: undercloud
|
||||||
|
tripleo_overcloud_network_provision_log_output: false
|
||||||
|
tripleo_overcloud_network_provision_debug: true
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: "Include tripleo_overcloud_network_provision"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_network_provision"
|
||||||
|
|
||||||
|
- name: Check role
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_network_provision_output == "overcloud network provision -y"
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_network_provision_output_file"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_network_provision"
|
||||||
|
vars:
|
||||||
|
tripleo_overcloud_network_provision_output_file: foo.yaml
|
||||||
|
|
||||||
|
- name: Validate tripleo_overcloud_network_provision_output_file
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_network_provision_output ==
|
||||||
|
"overcloud network provision -o foo.yaml"
|
||||||
|
|
||||||
|
- name: Assert "tripleo_overcloud_network_provision_deployment_file"
|
||||||
|
include_role:
|
||||||
|
name: "tripleo_overcloud_network_provision"
|
||||||
|
vars:
|
||||||
|
tripleo_overcloud_network_provision_deployment_file: deploy.yaml
|
||||||
|
|
||||||
|
- name: Validate tripleo_overcloud_network_provision_deployment_file
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- tripleo_overcloud_network_provision_output ==
|
||||||
|
"overcloud network provision deploy.yaml"
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: delegated
|
||||||
|
options:
|
||||||
|
managed: false
|
||||||
|
ansible_connection_options:
|
||||||
|
ansible_connection: local
|
||||||
|
log: true
|
||||||
|
platforms:
|
||||||
|
- name: instance
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
scenario:
|
||||||
|
name: default
|
||||||
|
test_sequence:
|
||||||
|
- prepare
|
||||||
|
- syntax
|
||||||
|
- converge
|
||||||
|
- verify
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: Include molecule prep
|
||||||
|
include_role:
|
||||||
|
name: test_molecule_prep
|
|
@ -0,0 +1,58 @@
|
||||||
|
---
|
||||||
|
# tasks file for tripleo_overcloud_network_provision
|
||||||
|
- name: Set overcloud network provision facts
|
||||||
|
set_fact:
|
||||||
|
_provision_cmd: >-
|
||||||
|
{{ tripleo_overcloud_network_provision_os_cloud | ternary('', "source " ~ tripleo_overcloud_network_provision_rc_file ~ "; ") }}
|
||||||
|
{{ openstack_bin }} overcloud network provision -y
|
||||||
|
{{ tripleo_overcloud_network_provision_output_file | ternary('-o $PROVISION_OUTPUT', '') }}
|
||||||
|
{{ tripleo_overcloud_network_provision_deployment_file }}
|
||||||
|
{{ tripleo_overcloud_network_provision_log_output | ternary((">" ~ tripleo_overcloud_network_provision_log), '') }}
|
||||||
|
{{ tripleo_overcloud_network_provision_log_combine | ternary("2>&1", '') }}
|
||||||
|
_provision_env:
|
||||||
|
OS_CLOUD: "{{ tripleo_overcloud_network_provision_os_cloud }}"
|
||||||
|
PROVISION_OUTPUT: "{{ tripleo_overcloud_network_provision_output_file | quote }}"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Preserve existing log file if exists
|
||||||
|
timestamp_file:
|
||||||
|
path: "{{ tripleo_overcloud_network_provision_log }}"
|
||||||
|
when: tripleo_overcloud_network_provision_log_output|bool
|
||||||
|
|
||||||
|
- name: Show debug information
|
||||||
|
when: tripleo_overcloud_network_provision_debug|bool
|
||||||
|
block:
|
||||||
|
- name: Show the command
|
||||||
|
debug:
|
||||||
|
var: _provision_cmd
|
||||||
|
|
||||||
|
- name: Show the environment
|
||||||
|
debug:
|
||||||
|
var: _provision_env
|
||||||
|
|
||||||
|
- name: Write reproducer script
|
||||||
|
tripleo_shell_script:
|
||||||
|
dest: "{{ tripleo_overcloud_network_provision_home_dir }}/tripleo_overcloud_network_provision.sh"
|
||||||
|
shell_command: "{{ _provision_cmd }}"
|
||||||
|
shell_environment: "{{ _provision_env }}"
|
||||||
|
when: tripleo_overcloud_network_provision_generate_scripts|bool
|
||||||
|
|
||||||
|
- name: overcloud network provision
|
||||||
|
shell: "{{ _provision_cmd }}" # noqa 305
|
||||||
|
environment: "{{ _provision_env }}"
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
chdir: "{{ tripleo_overcloud_network_provision_home_dir }}"
|
||||||
|
warn: false
|
||||||
|
register: tripleo_overcloud_network_provision_result
|
||||||
|
changed_when: false
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode|bool
|
||||||
|
- not tripleo_overcloud_network_provision_generate_scripts_only|bool
|
||||||
|
|
||||||
|
|
||||||
|
- name: Set output fact
|
||||||
|
when:
|
||||||
|
- tripleo_overcloud_network_provision_result.stdout is defined
|
||||||
|
set_fact:
|
||||||
|
tripleo_overcloud_network_provision_output: "{{ tripleo_overcloud_network_provision_result.stdout }}"
|
|
@ -0,0 +1 @@
|
||||||
|
localhost
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
remote_user: root
|
||||||
|
roles:
|
||||||
|
- tripleo_overcloud_network_provision
|
Loading…
Reference in New Issue