2015-09-18 12:49:28 +00:00
|
|
|
# Copyright 2015 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2018-02-09 14:56:13 +00:00
|
|
|
import os
|
2020-10-28 18:24:05 +00:00
|
|
|
import sys
|
2018-02-09 14:56:13 +00:00
|
|
|
|
2020-05-11 16:07:51 +00:00
|
|
|
from osc_lib.i18n import _
|
2020-06-23 00:58:44 +00:00
|
|
|
from six.moves import configparser
|
2020-05-11 16:07:51 +00:00
|
|
|
|
2015-09-18 12:49:28 +00:00
|
|
|
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
2016-09-20 11:16:36 +00:00
|
|
|
OVERCLOUD_YAML_NAME = "overcloud.yaml"
|
2016-09-23 10:57:10 +00:00
|
|
|
OVERCLOUD_ROLES_FILE = "roles_data.yaml"
|
2019-05-03 17:57:27 +00:00
|
|
|
MINION_ROLES_FILE = "roles/UndercloudMinion.yaml"
|
|
|
|
MINION_OUTPUT_DIR = os.path.join(os.environ.get('HOME', '~/'))
|
|
|
|
MINION_CONF_PATH = os.path.join(MINION_OUTPUT_DIR, "minion.conf")
|
|
|
|
MINION_LOG_FILE = "install-minion.log"
|
2018-01-11 17:04:19 +00:00
|
|
|
UNDERCLOUD_ROLES_FILE = "roles_data_undercloud.yaml"
|
2018-06-26 10:38:17 +00:00
|
|
|
STANDALONE_EPHEMERAL_STACK_VSTATE = '/var/lib/tripleo-heat-installer'
|
2018-06-19 10:00:25 +00:00
|
|
|
UNDERCLOUD_LOG_FILE = "install-undercloud.log"
|
2017-08-15 15:34:57 +00:00
|
|
|
OVERCLOUD_NETWORKS_FILE = "network_data.yaml"
|
2019-01-02 14:21:36 +00:00
|
|
|
STANDALONE_NETWORKS_FILE = "/dev/null"
|
|
|
|
UNDERCLOUD_NETWORKS_FILE = "network_data_undercloud.yaml"
|
2020-02-24 08:46:03 +00:00
|
|
|
ANSIBLE_HOSTS_FILENAME = "hosts.yaml"
|
2021-06-07 07:01:41 +00:00
|
|
|
EPHEMERAL_HEAT_POD_NAME = "ephemeral-heat"
|
2020-06-16 17:43:37 +00:00
|
|
|
ANSIBLE_CWL = "tripleo_dense,tripleo_profile_tasks,tripleo_states"
|
2020-08-17 06:56:30 +00:00
|
|
|
CONTAINER_IMAGE_PREPARE_LOG_FILE = "container_image_prepare.log"
|
2021-02-08 21:29:07 +00:00
|
|
|
DEFAULT_CONTAINER_REGISTRY = "quay.io"
|
2020-10-13 20:41:07 +00:00
|
|
|
DEFAULT_CONTAINER_NAMESPACE = "tripleomaster"
|
|
|
|
DEFAULT_CONTAINER_TAG = "current-tripleo"
|
2021-02-03 12:52:40 +00:00
|
|
|
DEFAULT_RESOURCE_REGISTRY = 'overcloud-resource-registry-puppet.yaml'
|
2020-10-13 20:41:07 +00:00
|
|
|
DEFAULT_HEAT_CONTAINER = ('{}/{}/openstack-heat-all:{}'.format(
|
|
|
|
DEFAULT_CONTAINER_REGISTRY,
|
|
|
|
DEFAULT_CONTAINER_NAMESPACE,
|
|
|
|
DEFAULT_CONTAINER_TAG))
|
2021-02-08 21:06:54 +00:00
|
|
|
DEFAULT_HEAT_API_CONTAINER = ('{}/{}/openstack-heat-api:{}'.format(
|
|
|
|
DEFAULT_CONTAINER_REGISTRY,
|
|
|
|
DEFAULT_CONTAINER_NAMESPACE,
|
|
|
|
DEFAULT_CONTAINER_TAG))
|
|
|
|
DEFAULT_HEAT_ENGINE_CONTAINER = ('{}/{}/openstack-heat-engine:{}'.format(
|
|
|
|
DEFAULT_CONTAINER_REGISTRY,
|
|
|
|
DEFAULT_CONTAINER_NAMESPACE,
|
|
|
|
DEFAULT_CONTAINER_TAG))
|
2020-10-13 20:41:07 +00:00
|
|
|
|
|
|
|
|
2018-02-05 09:54:12 +00:00
|
|
|
USER_PARAMETERS = 'user-environments/tripleoclient-parameters.yaml'
|
2021-04-20 13:37:05 +00:00
|
|
|
PASSWORDS_ENV_FORMAT = '{}-passwords.yaml'
|
2017-06-19 15:06:26 +00:00
|
|
|
|
|
|
|
# This directory may contain additional environments to use during deploy
|
2017-11-28 19:29:01 +00:00
|
|
|
DEFAULT_ENV_DIRECTORY = os.path.join(os.environ.get('HOME', '~/'),
|
2018-02-09 14:56:13 +00:00
|
|
|
'.tripleo', 'environments')
|
2020-10-14 04:18:48 +00:00
|
|
|
DEPLOYED_SERVER_ENVIRONMENT = 'environments/deployed-server-environment.yaml'
|
2017-10-20 15:37:03 +00:00
|
|
|
TRIPLEO_PUPPET_MODULES = "/usr/share/openstack-puppet/modules/"
|
|
|
|
PUPPET_MODULES = "/etc/puppet/modules/"
|
|
|
|
PUPPET_BASE = "/etc/puppet/"
|
2019-01-08 08:06:54 +00:00
|
|
|
|
2017-11-24 16:10:40 +00:00
|
|
|
STACK_TIMEOUT = 240
|
2018-02-15 16:25:49 +00:00
|
|
|
|
2018-06-13 06:21:44 +00:00
|
|
|
IRONIC_HTTP_BOOT_BIND_MOUNT = '/var/lib/ironic/httpboot'
|
2019-11-13 01:53:58 +00:00
|
|
|
IRONIC_LOCAL_IMAGE_PATH = '/var/lib/ironic/images'
|
2018-03-30 12:43:54 +00:00
|
|
|
|
2018-02-15 16:25:49 +00:00
|
|
|
# The default minor update ansible playbooks generated from heat stack output
|
2018-06-11 11:59:37 +00:00
|
|
|
MINOR_UPDATE_PLAYBOOKS = ['update_steps_playbook.yaml']
|
2018-02-22 16:21:09 +00:00
|
|
|
# The default major upgrade ansible playbooks generated from heat stack output
|
|
|
|
MAJOR_UPGRADE_PLAYBOOKS = ["upgrade_steps_playbook.yaml",
|
|
|
|
"deploy_steps_playbook.yaml",
|
|
|
|
"post_upgrade_steps_playbook.yaml"]
|
2018-03-12 11:11:03 +00:00
|
|
|
MAJOR_UPGRADE_SKIP_TAGS = ['validation', 'pre-upgrade']
|
2018-07-12 15:38:49 +00:00
|
|
|
EXTERNAL_UPDATE_PLAYBOOKS = ['external_update_steps_playbook.yaml']
|
|
|
|
EXTERNAL_UPGRADE_PLAYBOOKS = ['external_upgrade_steps_playbook.yaml']
|
2018-04-04 16:18:33 +00:00
|
|
|
# upgrade environment files expected by the client in the --templates
|
|
|
|
# tripleo-heat-templates default above $TRIPLEO_HEAT_TEMPLATES
|
2018-04-09 14:40:21 +00:00
|
|
|
UPDATE_PREPARE_ENV = "environments/lifecycle/update-prepare.yaml"
|
|
|
|
UPDATE_CONVERGE_ENV = "environments/lifecycle/update-converge.yaml"
|
2018-04-04 16:18:33 +00:00
|
|
|
UPGRADE_PREPARE_ENV = "environments/lifecycle/upgrade-prepare.yaml"
|
|
|
|
UPGRADE_CONVERGE_ENV = "environments/lifecycle/upgrade-converge.yaml"
|
2020-06-16 20:36:23 +00:00
|
|
|
UPGRADE_CONVERGE_FORBIDDEN_PARAMS = ["ceph3_namespace",
|
|
|
|
"ceph3_tag",
|
|
|
|
"ceph3_image",
|
|
|
|
"name_prefix_stein",
|
|
|
|
"name_suffix_stein",
|
|
|
|
"namespace_stein",
|
|
|
|
"tag_stein",
|
|
|
|
]
|
2018-05-03 16:57:52 +00:00
|
|
|
|
2018-11-29 00:14:38 +00:00
|
|
|
ENABLE_SSH_ADMIN_TIMEOUT = 600
|
2018-05-03 16:57:52 +00:00
|
|
|
ENABLE_SSH_ADMIN_STATUS_INTERVAL = 5
|
2020-02-25 21:47:14 +00:00
|
|
|
ENABLE_SSH_ADMIN_SSH_PORT_TIMEOUT = 600
|
2018-07-06 01:29:40 +00:00
|
|
|
|
|
|
|
ADDITIONAL_ARCHITECTURES = ['ppc64le']
|
2018-07-27 12:59:42 +00:00
|
|
|
|
2020-09-14 06:28:15 +00:00
|
|
|
DEFAULT_VALIDATIONS_BASEDIR = "/usr/share/ansible"
|
2019-11-21 11:13:25 +00:00
|
|
|
|
|
|
|
VALIDATIONS_LOG_BASEDIR = '/var/log/validations'
|
|
|
|
|
2020-04-21 10:43:07 +00:00
|
|
|
DEFAULT_WORK_DIR = os.path.join(os.environ.get('HOME', '~/'),
|
|
|
|
'config-download')
|
2019-04-02 13:42:46 +00:00
|
|
|
|
2021-02-08 21:06:54 +00:00
|
|
|
DEFAULT_TEMPLATES_DIR = "/usr/share/python-tripleoclient/templates"
|
2019-11-21 11:13:25 +00:00
|
|
|
|
2021-02-08 21:06:54 +00:00
|
|
|
TRIPLEO_STATIC_INVENTORY = 'tripleo-ansible-inventory.yaml'
|
2021-02-25 12:02:07 +00:00
|
|
|
ANSIBLE_INVENTORY = os.path.join(DEFAULT_WORK_DIR,
|
|
|
|
'{}/', TRIPLEO_STATIC_INVENTORY)
|
2021-06-02 05:05:47 +00:00
|
|
|
ANSIBLE_VALIDATION_DIR = "/usr/share/ansible/validation-playbooks"
|
2020-09-01 19:57:43 +00:00
|
|
|
|
2020-10-28 18:24:05 +00:00
|
|
|
# NOTE(mwhahaha): So if we pip install tripleoclient, we need to also
|
|
|
|
# honor pulling some other files from a venv (e.g. cli playbooks,
|
|
|
|
# and container image yaml for building). This logic will create a
|
|
|
|
# constant for a venv share path which we can use to check to see if things
|
|
|
|
# like tripleo-common or tripleo-ansible have also been pip installed.
|
|
|
|
SHARE_BASE_PATH = os.path.join(sys.prefix, 'share')
|
|
|
|
if sys.prefix != '/usr' and not os.path.isdir(SHARE_BASE_PATH):
|
|
|
|
SHARE_BASE_PATH = os.path.join('/usr', 'share')
|
|
|
|
|
|
|
|
ANSIBLE_TRIPLEO_PLAYBOOKS = os.path.join(
|
|
|
|
SHARE_BASE_PATH, 'ansible', 'tripleo-playbooks'
|
|
|
|
)
|
|
|
|
if sys.prefix != '/usr' and not os.path.isdir(ANSIBLE_TRIPLEO_PLAYBOOKS):
|
|
|
|
ANSIBLE_TRIPLEO_PLAYBOOKS = os.path.join(
|
|
|
|
'/usr', 'share', 'ansible', 'tripleo-playbooks'
|
|
|
|
)
|
|
|
|
CONTAINER_IMAGES_BASE_PATH = os.path.join(
|
|
|
|
SHARE_BASE_PATH, "tripleo-common", "container-images"
|
|
|
|
)
|
|
|
|
if sys.prefix != "/usr" and not os.path.isdir(CONTAINER_IMAGES_BASE_PATH):
|
|
|
|
CONTAINER_IMAGES_BASE_PATH = os.path.join(
|
|
|
|
"/usr", "share", "tripleo-common", "container-images"
|
|
|
|
)
|
|
|
|
|
2021-06-02 05:05:47 +00:00
|
|
|
VALIDATION_GROUPS_INFO = "{}/groups.yaml".format(DEFAULT_VALIDATIONS_BASEDIR)
|
2019-11-08 15:35:53 +00:00
|
|
|
|
Calculate undercloud ctlplane DHCP allocation pools
* Make dhcp_start and dhcp_end optional for subnet definitions
in undercloud.conf.
* Allow non-contiguous allocation pools for ctlplane subnets
Calcualte the allocation pools by removing the local_ip,
gateway, admin_host, public_host and ``inspection_iprange``,
from the subnets full ip range. Allocation_pools for all
remaining ranges will be configured. A new per-subnet option
``dhcp_exclude`` is added, a list of IP addresses or IP
ranges that will be excluded from the allocation pool. For
example:
dhcp_exclude = 172.20.0.101,172.20.0.210-172.20.0.219
^ ip addr ^ ip range
If dhcp_start is defined and dhcp_end is not defined (or vice
versa) any addresses prior to (or after) this address is
removed from the allocation pools.
Make dhcp_start and dhcp_end options ListOpts to enable non-
contigous allocation pools. For example, to create allocation
pools: [{'start': '172.20.0.100', 'end': '172.20.0.150'},
{'start': '172.20.0.200', 'end': '172.20.0.250'}]
the following configuration can be used in undercloud.conf:
dhcp_start = 172.20.0.100,172.20.0.200
dhcp_end = 172.20.0.150,172.20.0.250
A new method is added for remote_subnet_opts, same options as
for the local_subnet_opts but without the defaults.
To allow optional dhcp_start and dhcp_end for the local_subnet
which have defaults defined, a condition is used to ignore
dhcp_start and dhcp_end in case they are the default values
and the cidr is NOT the default.
Related-Bug: #1806512
Related-Bug: #1807707
Change-Id: I4ba148f465b4c452bd5b2c31009ac8a2897bcd5f
2018-12-04 14:41:41 +00:00
|
|
|
# ctlplane network defaults
|
2021-02-25 16:08:59 +00:00
|
|
|
CTLPLANE_NET_NAME = 'ctlplane'
|
Calculate undercloud ctlplane DHCP allocation pools
* Make dhcp_start and dhcp_end optional for subnet definitions
in undercloud.conf.
* Allow non-contiguous allocation pools for ctlplane subnets
Calcualte the allocation pools by removing the local_ip,
gateway, admin_host, public_host and ``inspection_iprange``,
from the subnets full ip range. Allocation_pools for all
remaining ranges will be configured. A new per-subnet option
``dhcp_exclude`` is added, a list of IP addresses or IP
ranges that will be excluded from the allocation pool. For
example:
dhcp_exclude = 172.20.0.101,172.20.0.210-172.20.0.219
^ ip addr ^ ip range
If dhcp_start is defined and dhcp_end is not defined (or vice
versa) any addresses prior to (or after) this address is
removed from the allocation pools.
Make dhcp_start and dhcp_end options ListOpts to enable non-
contigous allocation pools. For example, to create allocation
pools: [{'start': '172.20.0.100', 'end': '172.20.0.150'},
{'start': '172.20.0.200', 'end': '172.20.0.250'}]
the following configuration can be used in undercloud.conf:
dhcp_start = 172.20.0.100,172.20.0.200
dhcp_end = 172.20.0.150,172.20.0.250
A new method is added for remote_subnet_opts, same options as
for the local_subnet_opts but without the defaults.
To allow optional dhcp_start and dhcp_end for the local_subnet
which have defaults defined, a condition is used to ignore
dhcp_start and dhcp_end in case they are the default values
and the cidr is NOT the default.
Related-Bug: #1806512
Related-Bug: #1807707
Change-Id: I4ba148f465b4c452bd5b2c31009ac8a2897bcd5f
2018-12-04 14:41:41 +00:00
|
|
|
CTLPLANE_CIDR_DEFAULT = '192.168.24.0/24'
|
|
|
|
CTLPLANE_DHCP_START_DEFAULT = ['192.168.24.5']
|
|
|
|
CTLPLANE_DHCP_END_DEFAULT = ['192.168.24.24']
|
|
|
|
CTLPLANE_INSPECTION_IPRANGE_DEFAULT = '192.168.24.100,192.168.24.120'
|
|
|
|
CTLPLANE_GATEWAY_DEFAULT = '192.168.24.1'
|
2019-06-25 12:41:02 +00:00
|
|
|
CTLPLANE_DNS_NAMESERVERS_DEFAULT = []
|
2019-02-14 10:42:42 +00:00
|
|
|
|
2019-07-20 02:45:52 +00:00
|
|
|
# Ansible parameters used for the actions being executed during tripleo
|
|
|
|
# deploy/upgrade. Used as kwargs in the `utils.run_ansible_playbook`
|
|
|
|
# function. A playbook entry is either a string representing the name of
|
|
|
|
# one the playbook or a list of playbooks to execute. The lookup
|
|
|
|
# will search for the playbook in the work directory path.
|
2019-02-14 10:42:42 +00:00
|
|
|
DEPLOY_ANSIBLE_ACTIONS = {
|
2019-07-20 02:45:52 +00:00
|
|
|
'deploy': {
|
|
|
|
'playbook': 'deploy_steps_playbook.yaml'
|
|
|
|
},
|
|
|
|
'upgrade': {
|
|
|
|
'playbook': 'upgrade_steps_playbook.yaml',
|
|
|
|
'skip_tags': 'validation'
|
|
|
|
},
|
|
|
|
'post-upgrade': {
|
|
|
|
'playbook': 'post_upgrade_steps_playbook.yaml',
|
|
|
|
'skip_tags': 'validation'
|
|
|
|
},
|
|
|
|
'online-upgrade': {
|
|
|
|
'playbook': 'external_upgrade_steps_playbook.yaml',
|
|
|
|
'tags': 'online_upgrade'
|
|
|
|
},
|
|
|
|
'preflight-deploy': {
|
|
|
|
'playbook': 'undercloud-disk-space.yaml'
|
|
|
|
},
|
|
|
|
'preflight-upgrade': {
|
|
|
|
'playbook': 'undercloud-disk-space-pre-upgrade.yaml'
|
|
|
|
},
|
2019-02-14 10:42:42 +00:00
|
|
|
}
|
2019-05-02 11:36:30 +00:00
|
|
|
|
|
|
|
# Key-value pair of deprecated service and its warning message
|
2021-03-15 08:49:53 +00:00
|
|
|
DEPRECATED_SERVICES = {}
|
2019-06-11 13:19:20 +00:00
|
|
|
|
|
|
|
# clouds_yaml related constants
|
2020-03-23 19:12:50 +00:00
|
|
|
CLOUD_HOME_DIR = os.path.expanduser('~' + os.environ.get('SUDO_USER', ''))
|
2019-06-11 13:19:20 +00:00
|
|
|
CLOUDS_YAML_DIR = os.path.join('.config', 'openstack')
|
2019-09-05 16:04:03 +00:00
|
|
|
|
2020-03-23 21:06:38 +00:00
|
|
|
# Undercloud config and output
|
|
|
|
UNDERCLOUD_CONF_PATH = os.path.join(CLOUD_HOME_DIR, "undercloud.conf")
|
|
|
|
try:
|
|
|
|
if os.path.exists(UNDERCLOUD_CONF_PATH):
|
2020-06-23 00:58:44 +00:00
|
|
|
config = configparser.ConfigParser()
|
2020-03-23 21:06:38 +00:00
|
|
|
config.read(UNDERCLOUD_CONF_PATH)
|
|
|
|
UNDERCLOUD_OUTPUT_DIR = config.get('DEFAULT', 'output_dir')
|
|
|
|
else:
|
|
|
|
raise FileNotFoundError
|
2020-06-23 00:58:44 +00:00
|
|
|
except (configparser.NoOptionError, FileNotFoundError):
|
2020-03-23 21:06:38 +00:00
|
|
|
UNDERCLOUD_OUTPUT_DIR = CLOUD_HOME_DIR
|
|
|
|
|
2021-02-01 02:51:33 +00:00
|
|
|
# regex patterns to exclude when looking for unused params
|
|
|
|
# - exclude *Image params as they may be unused because the service is not
|
|
|
|
# enabled
|
|
|
|
# - exclude SwiftFetchDir*Tempurl because it's used by ceph and generated by us
|
|
|
|
# - exclude PythonInterpreter because it's generated by us and only used
|
|
|
|
# in some custom scripts
|
|
|
|
UNUSED_PARAMETER_EXCLUDES_RE = ['^(Docker|Container).*Image$',
|
|
|
|
'^SwiftFetchDir(Get|Put)Tempurl$',
|
|
|
|
'^PythonInterpreter$']
|
|
|
|
|
2019-11-04 20:59:10 +00:00
|
|
|
EXPORT_PASSWORD_EXCLUDE_PATTERNS = [
|
|
|
|
'ceph.*'
|
|
|
|
]
|
2020-04-03 11:44:01 +00:00
|
|
|
|
|
|
|
# Package that need to be to the latest before undercloud
|
2020-07-02 12:43:36 +00:00
|
|
|
# update/update
|
2020-04-03 11:44:01 +00:00
|
|
|
UNDERCLOUD_EXTRA_PACKAGES = [
|
2020-04-09 19:46:36 +00:00
|
|
|
"openstack-tripleo-common",
|
2020-04-03 11:44:01 +00:00
|
|
|
"openstack-tripleo-heat-templates",
|
|
|
|
"openstack-tripleo-validations",
|
|
|
|
"tripleo-ansible"
|
|
|
|
]
|
2020-05-11 16:07:51 +00:00
|
|
|
|
2020-05-22 13:30:00 +00:00
|
|
|
UPGRADE_PROMPT = _('You are about to run a UPGRADE command. '
|
|
|
|
'It is strongly recommended to perform a backup '
|
2020-05-11 16:07:51 +00:00
|
|
|
'before the upgrade. Are you sure you want to '
|
|
|
|
'upgrade [y/N]?')
|
|
|
|
UPGRADE_NO = _('User did not confirm upgrade, so exiting. '
|
2020-05-22 13:30:00 +00:00
|
|
|
'Consider using the --yes/-y parameter if you '
|
2020-05-11 16:07:51 +00:00
|
|
|
'prefer to skip this warning in the future')
|
2020-05-22 13:30:00 +00:00
|
|
|
UPDATE_PROMPT = _('You are about to run a UPDATE command. '
|
|
|
|
'It is strongly recommended to perform a backup '
|
|
|
|
'before the update. Are you sure you want to '
|
|
|
|
'update [y/N]?')
|
|
|
|
UPDATE_NO = _('User did not confirm update, so exiting. '
|
|
|
|
'Consider using the --yes/-y parameter if you '
|
|
|
|
'prefer to skip this warning in the future')
|