diff --git a/roles/adoption_osp_deploy/README.md b/roles/adoption_osp_deploy/README.md new file mode 100644 index 0000000000..6f3888bd84 --- /dev/null +++ b/roles/adoption_osp_deploy/README.md @@ -0,0 +1,12 @@ +# adoption_osp_deploy + +Deploy OSP 17.1 environment for adoption based on DTs. + +## Privilege escalation +None + +## Parameters +* `adoption_osp_deploy_ntp_server`: (String) NTP server to use in the 17.1 +deployment. Defaults to `pool.ntp.org` + +## Examples diff --git a/roles/adoption_osp_deploy/defaults/main.yml b/roles/adoption_osp_deploy/defaults/main.yml new file mode 100644 index 0000000000..b1a0fb2722 --- /dev/null +++ b/roles/adoption_osp_deploy/defaults/main.yml @@ -0,0 +1,19 @@ +--- +# Copyright 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. + + +# All variables intended for modification should be placed in this file. +# All variables within this role should have a prefix of "cifmw_adoption_osp_deploy" diff --git a/roles/adoption_osp_deploy/files/undercloud.conf b/roles/adoption_osp_deploy/files/undercloud.conf new file mode 100644 index 0000000000..4612f81fcb --- /dev/null +++ b/roles/adoption_osp_deploy/files/undercloud.conf @@ -0,0 +1,272 @@ +[DEFAULT] +# +# From instack-undercloud +# + +# Local file path to the necessary images. The path should be a +# directory readable by the current user that contains the full set of +# images. (string value) +#image_path = . + +# Fully qualified hostname (including domain) to set on the +# Undercloud. If left unset, the current hostname will be used, but +# the user is responsible for configuring all system hostname settings +# appropriately. If set, the undercloud install will configure all +# system hostname settings. (string value) +undercloud_hostname = undercloud.localdomain + +# IP information for the interface on the Undercloud that will be +# handling the PXE boots and DHCP for Overcloud instances. The IP +# portion of the value will be assigned to the network interface +# defined by local_interface, with the netmask defined by the prefix +# portion of the value. (string value) +local_ip = 192.168.122.100/24 + +# MTU, set neutron on the undercloud to match mtu of the nics +# (string value) +local_mtu = 1500 + +# Virtual IP or DNS address to use for the public endpoints of +# Undercloud services. Only used with SSL. (string value) +# Deprecated group/name - [DEFAULT]/undercloud_public_vip +#undercloud_public_host = 192.168.24.2 +undercloud_public_host = 192.168.122.122 + +# Virtual IP or DNS address to use for the admin endpoints of +# Undercloud services. Only used with SSL. (string value) +# Deprecated group/name - [DEFAULT]/undercloud_admin_vip +#undercloud_admin_host = 192.168.24.3 +undercloud_admin_host = 192.168.122.123 + +# Nameserver for the Undercloud node. +# (string value) +undercloud_nameservers = 192.168.122.10 + +# List of ntp servers to use. (list value) +undercloud_ntp_servers = pool.ntp.org + +# Timezone for the Undercloud node. (string value) +undercloud_timezone = UTC + +# DNS domain name to use when deploying the overcloud. The overcloud +# parameter "CloudDomain" must be set to a matching value. (string +# value) +#overcloud_domain_name = localdomain + +# Certificate file to use for OpenStack service SSL connections. +# Setting this enables SSL for the OpenStack API endpoints, leaving it +# unset disables SSL. (string value) +#undercloud_service_certificate = + +# When set to True, an SSL certificate will be generated as part of +# the undercloud install and this certificate will be used in place of +# the value for undercloud_service_certificate. The resulting +# certificate will be written to +# /etc/pki/tls/certs/undercloud-[undercloud_public_vip].pem. This +# certificate is signed by CA selected by the +# "certificate_generation_ca" option. (boolean value) +#generate_service_certificate = true +generate_service_certificate = False + +# The certmonger nickname of the CA from which the certificate will be +# requested. This is used only if the generate_service_certificate +# option is set. Note that if the "local" CA is selected the +# certmonger's local CA certificate will be extracted to /etc/pki/ca- +# trust/source/anchors/cm-local-ca.pem and subsequently added to the +# trust chain. (string value) +#certificate_generation_ca = local + +# Network interface on the Undercloud that will be handling the PXE +# boots and DHCP for Overcloud instances. (string value) +local_interface = eth1 + +# Path to hieradata override file. If set, the file will be copied +# under /etc/puppet/hieradata and set as the first file in the hiera +# hierarchy. This can be used to to custom configure services beyond +# what undercloud.conf provides (string value) +hieradata_override = /home/zuul/hieradata_overrides_undercloud.yaml + +# Network interface on which inspection dnsmasq will listen. If in +# doubt, use the default value. (string value) +# Deprecated group/name - [DEFAULT]/discovery_interface +#inspection_interface = br-ctlplane + +# Whether to enable extra hardware collection during the inspection +# process. + +# Whether to run benchmarks when inspecting nodes. (boolean value) +# Deprecated group/name - [DEFAULT]/discovery_runbench +#inspection_runbench = false + +# Whether to enable the debug log level for Undercloud OpenStack +# services. (boolean value) +undercloud_debug = True + +# Container CLI used for deployment; +# Can be docker or podman. (string value) +container_cli = podman + +# Enable or disable SELinux during the deployment. (boolean value) +undercloud_enable_selinux = false + +# Enable or disable Paunch to manage containers. (boolean value) +# undercloud_enable_paunch = true + +# Whether to install Tempest in the Undercloud. (boolean value) +enable_tempest = False + +# Whether to install Telemetry services (ceilometer, aodh) in the +# Undercloud. (boolean value) +enable_telemetry = False + +# Whether to install requirements to run the TripleO validations. +# (boolean value) +enable_validations = True + +# Whether to install Mistral in the Undercloud. (boolean value) +enable_mistral = false + +# Whether to install Ironic in the Undercloud. (boolean value) +enable_ironic = True + +# Whether to install Ironic-inspector in the Undercloud. (boolean value) +enable_ironic_inspector = True + +# Whether to install Zaqar in the Undercloud. (boolean value) +enable_zaqar = false + +# Whether to enable Swift encryption at-rest or not. (boolean value) +enable_swift_encryption = False + +# Whether to enable Nova in the Undercloud. (boolean value) +enable_nova = false + +# Whether to enable Heat in the Undercloud. (boolean value) +enable_heat = False + +# FIXME(mandre) turn this into ansible variable +heat_native=true + +# Whether to use iPXE for deploy by default. (boolean value) +ipxe_deploy = True + +# Whether to install Monitoring services in the Undercloud. (boolean +# value) +enable_monitoring = False + +# Whether to install novajoin metadata service in the Undercloud. +enable_novajoin = false + +# One Time Password to register Undercloud node with IPA server. +# Required when enable_novajoin = true. +# ipa_otp = + +# IPv6 address configuration mode for the undercloud provisioning +# network. (string value) +# Possible values: +# dhcpv6-stateless - Address configuration using RA and optional +# information using DHCPv6. +# dhcpv6-stateful - Address configuration and optional information +# using DHCPv6. +# ipv6_address_mode = dhcpv6-stateless + +# Ironic network interface implementation to use by default. (string +# value) +# Possible values: +# flat - Use one flat provider network. +# neutron - Ironic interacts with Neutron to enable other network +# types and advanced networking features. +#ironic_default_network_interface = flat + +# Enabled ironic network interface implementations. Each hardware type +# must have at least one valid implementation enabled. (list value) +#ironic_enabled_network_interfaces = flat + +# docker_registry_mirror = + +#docker_insecure_registries= + +# additional env files for undercloud, used with containers + +container_images_file = /home/zuul/containers-prepare-parameters.yaml + +#container_insecure_registries = + +custom_env_files = /home/zuul/undercloud-parameter-defaults.yaml + +net_config_override = /etc/os-net-config/config.yaml + +# Output directory for state, like downloaded ansible configs and +# processed heat templates for heat installer +#output_dir = /home/zuul/.undercloud-heat-installer + +# Clean up mode for the temp files for heat installer on exit +cleanup = False + +# Whether to clean undercloud rpms after an upgrade +# to a containerized undercloud. +#upgrade_cleanup = False + +# Heat templates directory +templates = /usr/share/openstack-tripleo-heat-templates + +# Extra config elements. + +# Enable support for routed ctlplane networks + + +# Whether to clean overcloud nodes (wipe the hard drive) between +# deployments and after the introspection. + +# List of routed network subnets for provisioning and introspection. +# Comma separated list of names/tags. For each network a section/group +# needs to be added to the configuration file with these parameters +# set: cidr, dhcp_start, dhcp_end, inspection_iprange, gateway and +# masquerade_network. Note: The section/group must be placed before or +# after any other section. (See the example section [ctlplane-subnet] +# in the sample configuration file.) (list value) +subnets = ctlplane-subnet + +# Name of the local subnet, where the PXE boot and DHCP interfaces for +# overcloud instances is located. The IP address of the +# local_ip/local_interface should reside in this subnet. (string +# value) +local_subnet = ctlplane-subnet + +[ctlplane-subnet] + +# Network CIDR for the Neutron-managed subnet for Overcloud instances. +# (string value) +# Deprecated group/name - [DEFAULT]/network_cidr +cidr = 192.168.122.0/24 + +# Start of DHCP allocation range for PXE and DHCP of Overcloud +# instances on this network. (string value) +# Deprecated group/name - [DEFAULT]/dhcp_start +dhcp_start = 192.168.122.110 + +# End of DHCP allocation range for PXE and DHCP of Overcloud instances +# on this network. (string value) +# Deprecated group/name - [DEFAULT]/dhcp_end +dhcp_end = 192.168.122.130 + +# DNS nameservers for the Neutron-managed subnet for the Overcloud +# instances on this network. If no nameservers are defined for the +# subnet, the nameservers defined for undercloud_nameservers will be +# used. (list value) +#dns_nameservers = + +# Network gateway for the Neutron-managed network for Overcloud +# instances on this network. (string value) +# Deprecated group/name - [DEFAULT]/network_gateway +gateway = 192.168.122.10 + +# Temporary IP range that will be given to nodes on this network +# during the inspection process. Should not overlap with the range +# defined by dhcp_start and dhcp_end, but should be in the same ip +# subnet. (string value) +# Deprecated group/name - [DEFAULT]/inspection_iprange +inspection_iprange = 192.168.122.200,192.168.122.220 + +# The network will be masqueraded for external access. (boolean value) +masquerade=True diff --git a/roles/adoption_osp_deploy/handlers/main.yml b/roles/adoption_osp_deploy/handlers/main.yml new file mode 100644 index 0000000000..ae5261d4ab --- /dev/null +++ b/roles/adoption_osp_deploy/handlers/main.yml @@ -0,0 +1,15 @@ +--- +# Copyright 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. diff --git a/roles/adoption_osp_deploy/meta/main.yml b/roles/adoption_osp_deploy/meta/main.yml new file mode 100644 index 0000000000..6c046d0d32 --- /dev/null +++ b/roles/adoption_osp_deploy/meta/main.yml @@ -0,0 +1,30 @@ +--- +# Copyright 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: CI Framework + description: CI Framework Role -- adoption_osp_deploy + company: Red Hat + license: Apache-2.0 + min_ansible_version: "2.14" + namespace: cifmw + galaxy_tags: + - cifmw + +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. +dependencies: [] diff --git a/roles/adoption_osp_deploy/molecule/default/converge.yml b/roles/adoption_osp_deploy/molecule/default/converge.yml new file mode 100644 index 0000000000..9eb41ce816 --- /dev/null +++ b/roles/adoption_osp_deploy/molecule/default/converge.yml @@ -0,0 +1,21 @@ +--- +# Copyright 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: Converge + hosts: all + roles: + - role: "adoption_osp_deploy" diff --git a/roles/adoption_osp_deploy/molecule/default/molecule.yml b/roles/adoption_osp_deploy/molecule/default/molecule.yml new file mode 100644 index 0000000000..fda947cafe --- /dev/null +++ b/roles/adoption_osp_deploy/molecule/default/molecule.yml @@ -0,0 +1,11 @@ +--- +# Mainly used to override the defaults set in .config/molecule/ +# By default, it uses the "config_podman.yml" - in CI, it will use +# "config_local.yml". +log: true + +provisioner: + name: ansible + log: true + env: + ANSIBLE_STDOUT_CALLBACK: yaml diff --git a/roles/adoption_osp_deploy/molecule/default/prepare.yml b/roles/adoption_osp_deploy/molecule/default/prepare.yml new file mode 100644 index 0000000000..d3594acc41 --- /dev/null +++ b/roles/adoption_osp_deploy/molecule/default/prepare.yml @@ -0,0 +1,21 @@ +--- +# Copyright 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: Prepare + hosts: all + roles: + - role: test_deps diff --git a/roles/adoption_osp_deploy/tasks/config_files.yml b/roles/adoption_osp_deploy/tasks/config_files.yml new file mode 100644 index 0000000000..37838b0c3e --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/config_files.yml @@ -0,0 +1,194 @@ +--- +# Copyright 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: Ensure networking data is loaded + ansible.builtin.import_role: + name: networking_mapper + tasks_from: load_env_definition.yml + +- name: Load scenario config-download + vars: + _config_download_path: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.config_download_file + ] | path_join + }} + ansible.builtin.slurp: + path: "{{ _config_download_path }}" + register: _original_config_download + +- name: Generate config download file + vars: + _config_download: > + {{ + _original_config_download['content'] | + b64decode | from_yaml + }} + _new_config_download_fields: {} + _ctlplane_net: "{{ cifmw_networking_env_definition.networks.ctlplane }}" + _hostname_map_translation: >- + {{ + _cifmw_scenario_content.adoption.hostname_groups_map + }} + block: + - name: Gather overcloud tripleo nodes + when: group.key is in _hostname_map_translation + ansible.builtin.set_fact: + _tripleo_nodes: >- + {{ + _tripleo_nodes | default([]) + + group.values + }} + loop: "{{ groups | dict2items }}" + loop_control: + loop_var: group + label: "{{ group.key }}" + + - name: Generate Hostnamemap field + when: group.key is in _hostname_map_translation + vars: + _tripleo_name: "{{ _hostname_map_translation[group.key] }}" + _group_nodes: >- + {%- set hosts = {} -%} + {%- for node in group.value -%} + {%- set key = _tripleo_name ~ '-' ~ loop.index0 | string -%} + {%- set _ = hosts.update({key: node}) -%} + {%- endfor -%} + {{ hosts }} + ansible.builtin.set_fact: + _hostname_map: >- + {{ + _hostname_map | default({}) | + combine(_group_nodes) + }} + loop: "{{ groups | dict2items }}" + loop_control: + loop_var: group + label: "{{ group.key }}" + + - name: Generate DeployedServerPortMap field + vars: + _node_instance_net: "{{ cifmw_networking_env_definition.instances[node] }}" + _key_name: "{{ node }}-ctlplane" + _ctlplane_ip: "{{ _node_instance_net.networks.ctlplane.ip_v4 }}" + _server_port: >- + {%- set port = {_key_name: {}} -%} + {%- set _ = port[_key_name].update({ + 'fixed_ips': [ + { 'ip_address': _ctlplane_ip } + ], + 'subnets': [ + {'cidr': _ctlplane_net.network_v4} + ], + 'network': { + 'tags': [ _ctlplane_net.network_v4 ] + }}) -%} + {{ port }} + ansible.builtin.set_fact: + _deployedserverport_map: >- + {{ + _deployedserverport_map | default({}) | + combine(_server_port, recursive=true) + }} + loop: "{{ _tripleo_nodes }}" + loop_control: + loop_var: node + label: "{{ node }}" + + - name: Generate NodePortMap field + vars: + _node_instance_net: "{{ cifmw_networking_env_definition.instances[node] }}" + _node_port: > + {%- set nodeport = {node: {}} -%} + {% for network, net_info in _node_instance_net.networks.items() %} + {%- set subnet = cifmw_networking_env_definition.networks[network].network_v4 -%} + {%- set _ = nodeport[node].update( + { + network: { + 'ip_address': net_info.ip_v4, + 'ip_address_uri': net_info.ip_v4, + 'ip_subnet': subnet + } + } + ) -%} + {%- endfor -%} + {{ nodeport }} + ansible.builtin.set_fact: + _nodeport_map: >- + {{ + _nodeport_map | default({}) | + combine(_node_port, recursive=true) + }} + loop: "{{ _tripleo_nodes }}" + loop_control: + loop_var: node + label: "{{ node }}" + + - name: Generate CtlplaneNetworkAttributes field + vars: + _cloud_domain: "{{ _cifmw_scenario_content.adoption.cloud_domain }}" + _dns_server: >- + {{ + (_ctlplane_net.dns_v4 | length > 0) | + ternary(_ctlplane_net.dns_v4, _ctlplane_net.gw_v4) + }} + ansible.builtin.set_fact: + _ctlplanenet_attributes: + network: + dns_domain: "{{ _cloud_domain }}" + mtu: "{{ _ctlplane_net.mtu }}" + subnets: + ctlplane-subnet: + dns_nameservers: "{{ _dns_server }}" + gateway_ip: "{{ _ctlplane_net.gw_v4 }}" + + - name: Create new config download file + vars: + _new_config_download_fields: + parameter_defaults: + HostnameMap: "{{ _hostname_map }}" + DeployedServerPortMap: "{{ _deployedserverport_map }}" + NodePortMap: "{{ _nodeport_map }}" + CtlplaneNetworkAttributes: "{{ _ctlplanenet_attributes }}" + ansible.builtin.copy: + dest: "/home/jgilaber/test/ansible/config-download.yaml" + content: "{{ _config_download | combine(_new_config_download_fields, recursive=true) | to_nice_yaml(indent=2, sort_keys=false) }}" + +- name: Copy undercloud.conf file to location to edit it + ansible.builtin.copy: + src: undercloud.conf + dest: "/home/zuul/undercloud.conf" + +- name: Generate undercloud.conf with scenario specific values + community.general.ini_file: + path: "/home/zuul/undercloud.conf" + section: "{{ item.section }}" + option: "{{ item.option }}" + value: "{{ item.value }}" + state: "present" + loop: "{{ _cifmw_scenario_content.adoption.undercloud.config }}" + +- name: Create containers-prepare-parameters if needed + vars: + _container_prepare_cmd: >- + openstack tripleo container image prepare + default --output-env-file + /home/zuul/containers-prepare-parameters.yaml + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _container_prepare_cmd }}" + when: _cifmw_scenario_content.adoption.container_prepare_params is not defined diff --git a/roles/adoption_osp_deploy/tasks/deploy_ceph.yml b/roles/adoption_osp_deploy/tasks/deploy_ceph.yml new file mode 100644 index 0000000000..ea3ef2a954 --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/deploy_ceph.yml @@ -0,0 +1,71 @@ +--- +# Copyright 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: Create block devices on compute nodes using ceph playbook + ansible.builtin.command: + cmd: >- + ansible-playbook ceph.yml + -i inventory.yaml --tags block -e cifmw_num_osds_perhost=1 + -e cifmw_ceph_target=osp-computes + +- name: Deploy 17.1 ceph + vars: + _architecture_path: "{{ cifmw_architecture_repo }}/automation/vars" + _roles_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.roles_file + ] | path_join + }} + _network_data_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.network_data_file + ] | path_join + }} + _ceph_osd_spec_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.ceph_osd_spec_file + ] | path_join + }} + _cloud_domain: {{ _cifmw_scenario_content.adoption.cloud_domain }} + block: + - name: Generate ceph_spec file + vars: + _ceph_spec_cmd: >- + openstack overcloud ceph spec config-download.yaml + --tld {{ _cloud_domain }} + --osd-spec {{ _ceph_osd_spec_file }} + --roles-file {{ _roles_file }} + -o ceph_spec.yaml + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _ceph_spec_cmd }}" + + - name: Deploy ceph + vars: + _ceph_deploy_cmd: >- + openstack openstack ceph deploy + --tld {{ _cloud_domain }} + --ntp-server {{ adoption_osp_deploy_ntp_server }} + --ceph-spec ceph_spec.yaml + --network-data {{ _network_data_file }} + --cephadm-default-container + --output ceph_spec.yaml + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _ceph_deploy_cmd }}" diff --git a/roles/adoption_osp_deploy/tasks/main.yml b/roles/adoption_osp_deploy/tasks/main.yml new file mode 100644 index 0000000000..f4e12084e7 --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/main.yml @@ -0,0 +1,54 @@ +--- +# Copyright 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: Prepare enviornment for OSP deployment + ansible.builtin.import_tasks: prepare.yml + +- name: Generate configuration files + ansible.builtin.import_tasks: config_files.yml + +- name: Run pre undercloud deploy hooks + vars: + hooks: "{{ _cifmw_scenario_content.adoption.pre_uc_run | default([]) }}" + ansible.builtin.include_role: + name: run_hook + +- name: Deploy undercloud + ansible.builtin.import_tasks: undercloud_deploy.yml + +- name: Run post undercloud deploy hooks + vars: + hooks: "{{ _cifmw_scenario_content.adoption.post_uc_run | default([]) }}" + ansible.builtin.include_role: + name: run_hook + +- name: Overcloud preparation + ansible.builtin.import_tasks: overcloud_prepare.yml + +- name: Run pre overcloud deploy hooks + vars: + hooks: "{{ _cifmw_scenario_content.adoption.pre_oc_run | default([]) }}" + ansible.builtin.include_role: + name: run_hook + +- name: Deploy overcloud + ansible.builtin.import_tasks: overcloud_deploy.yml + +- name: Run post overcloud deploy hooks + vars: + hooks: "{{ _cifmw_scenario_content.adoption.post_oc_run | default([]) }}" + ansible.builtin.include_role: + name: run_hook diff --git a/roles/adoption_osp_deploy/tasks/overcloud_deploy.yml b/roles/adoption_osp_deploy/tasks/overcloud_deploy.yml new file mode 100644 index 0000000000..1b030b6606 --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/overcloud_deploy.yml @@ -0,0 +1,66 @@ +--- +# Copyright 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: Deploy 17.1 overcloud + vars: + _architecture_path: "{{ cifmw_architecture_repo }}/automation/vars" + _roles_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.roles_file + ] | path_join + }} + _network_data_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.network_data_file + ] | path_join + }} + _overcloud_services_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.services_file + ] | path_join + }} + _overcloud_args: >- + {{ + _cifmw_scenario_content.adoption.overcloud.args | join(' ') + }} + _overcloud_vars: >- + {{ + _cifmw_scenario_content.adoption.overcloud.vars | join(' -e ') + }} + _overcloud_name: >- + {{ + _cifmw_scenario_content.adoption.overcloud.stackname | + default('overcloud') + }} + _overcloud_deploy_cmd: >- + openstack openstack overcloud deploy + --stack {{ _overcloud_name }} + {{ _overcloud_args }} + --roles-file {{ _roles_file }} + -n {{ _network_data_file }} + --ntp-server {{ adoption_osp_deploy_ntp_server }} + {{ _overcloud_vars }} + -e /home/zuul/containers-prepare-parameters.yaml + -e {{ overcloud_services_file }} + -e /home/zuul/config-download.yaml + -e /home/zuul/vips_provision_out.yaml + -e /home/zuul/network_provision_out.yaml + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _overcloud_deploy_cmd }}" diff --git a/roles/adoption_osp_deploy/tasks/overcloud_prepare.yml b/roles/adoption_osp_deploy/tasks/overcloud_prepare.yml new file mode 100644 index 0000000000..b6fc94c0dc --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/overcloud_prepare.yml @@ -0,0 +1,51 @@ +--- +# Copyright 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: Prepare enviornment for 17.1 overcloud deployment + vars: + _architecture_path: "{{ cifmw_architecture_repo }}/automation/vars" + _network_data_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.network_data_file + ] | path_join + }} + _vips_data_file: >- + {{ + [_architecture_path, + _cifmw_scenario_content.adoption.overcloud.vips_data_file + ] | path_join + }} + block: + - name: Provision openstack networks + vars: + _network_provision_cmd: >- + openstack overcloud network provision + --output network_provision_out.yaml + {{ _network_data_file }} + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _network_provision_cmd }}" + + - name: Provision virtual ips + vars: + _vip_provision_cmd: >- + openstack overcloud network vip provision + --output vips_provision_out.yaml + {{ _vips_data_file }} + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "{{ _vip_provision_cmd }}" diff --git a/roles/adoption_osp_deploy/tasks/prepare.yml b/roles/adoption_osp_deploy/tasks/prepare.yml new file mode 100644 index 0000000000..e979c47e44 --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/prepare.yml @@ -0,0 +1,18 @@ +--- +# Copyright 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: Ensure vms are started + ... diff --git a/roles/adoption_osp_deploy/tasks/undercloud_deploy.yml b/roles/adoption_osp_deploy/tasks/undercloud_deploy.yml new file mode 100644 index 0000000000..3ed35e81de --- /dev/null +++ b/roles/adoption_osp_deploy/tasks/undercloud_deploy.yml @@ -0,0 +1,20 @@ +--- +# Copyright 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: Deploy 17.1 undercloud + cifmw.general.ci_script: + output_dir: "{{ cifmw_artifacts_basedir }}/artifacts" + script: "openstack undercloud install" diff --git a/roles/adoption_osp_deploy/vars/main.yml b/roles/adoption_osp_deploy/vars/main.yml new file mode 100644 index 0000000000..cbb0eb46a3 --- /dev/null +++ b/roles/adoption_osp_deploy/vars/main.yml @@ -0,0 +1,22 @@ +--- +# Copyright 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. + + +# While options found within the vars/ path can be overridden using extra +# vars, items within this path are considered part of the role and not +# intended to be modified. + +# All variables within this role should have a prefix of "cifmw_adoption_osp_deploy"