diff --git a/deployment/nova/nova-az-config.yaml b/deployment/nova/nova-az-config.yaml new file mode 100644 index 0000000000..756200a877 --- /dev/null +++ b/deployment/nova/nova-az-config.yaml @@ -0,0 +1,91 @@ +heat_template_version: rocky + +description: > + Configuration of Nova Availability Zones in the overcloud + +parameters: + ServiceData: + default: {} + description: Dictionary packing service data + type: json + ServiceNetMap: + default: {} + description: Mapping of service_name -> network name. Typically set + via parameter_defaults in the resource registry. This + mapping overrides those in ServiceNetMapDefaults. + type: json + DefaultPasswords: + default: {} + type: json + RoleName: + default: '' + description: Role name on which the service is applied + type: string + RoleParameters: + default: {} + description: Parameters specific to the role + type: json + EndpointMap: + default: {} + description: Mapping of service endpoint -> protocol. Typically set + via parameter_defaults in the resource registry. + type: json + AdminPassword: + description: The password for the keystone admin account, used for monitoring, querying neutron etc. + type: string + hidden: true + NovaComputeAvailabilityZone: + description: The availability zone where new Nova compute nodes will be + added. If the zone does not already exist, it will be created. + default: "" + type: string + RootStackName: + description: The name of the stack/plan. + type: string + +resources: + + NovaComputeAvailabilityZoneValue: + type: OS::Heat::Value + properties: + value: + if: + - equals: + - {get_param: NovaComputeAvailabilityZone} + - "" + - {get_param: RootStackName} + - {get_param: NovaComputeAvailabilityZone} + +outputs: + role_data: + description: Role data for the Nova Availability Zone configuration service + value: + service_name: nova_az_config + deploy_steps_tasks: + # Step0: Set the hieradata nova::host as a ansible fact so that we can + # use it later in the tasks in external_post_deploy_tasks + - name: Get nova::host value + shell: hiera -c /etc/puppet/hiera.yaml nova::host + register: nova_host_result + when: "step|int == 1" + - name: Set nova_host fact + set_fact: + nova_host: "{{ nova_host_result.stdout }}" + when: "step|int == 1" + external_post_deploy_tasks: + - name: "Nova: Manage aggregate and availability zone and add hosts to the zone" + environment: + # Force openstackclient to not try and read a clouds.yaml as none + # exists for the tripleo-admin user. + OS_CLIENT_CONFIG_FILE: /dev/null + os_nova_host_aggregate: + name: {get_attr: [NovaComputeAvailabilityZoneValue, value]} + availability_zone: {get_attr: [NovaComputeAvailabilityZoneValue, value]} + hosts: "{{ groups['nova_compute'] | default([]) | map('extract', hostvars, 'nova_host') | list }}" + auth: + username: admin + password: {get_param: AdminPassword} + project_name: admin + project_domain_name: Default + user_domain_name: Default + auth_url: { get_param: [EndpointMap, KeystoneV3Public, uri] } diff --git a/environments/nova-az-config.yaml b/environments/nova-az-config.yaml new file mode 100644 index 0000000000..10ce3a90b5 --- /dev/null +++ b/environments/nova-az-config.yaml @@ -0,0 +1,2 @@ +resource_registry: + OS::TripleO::Services::NovaAZConfig: ../deployment/nova/nova-az-config.yaml diff --git a/overcloud-resource-registry-puppet.j2.yaml b/overcloud-resource-registry-puppet.j2.yaml index 6fd1875e90..6589c39125 100644 --- a/overcloud-resource-registry-puppet.j2.yaml +++ b/overcloud-resource-registry-puppet.j2.yaml @@ -204,6 +204,7 @@ resource_registry: OS::TripleO::Services::NovaScheduler: deployment/nova/nova-scheduler-container-puppet.yaml OS::TripleO::Services::NovaVncProxy: deployment/nova/nova-vnc-proxy-container-puppet.yaml OS::TripleO::Services::Novajoin: OS::Heat::None + OS::TripleO::Services::NovaAZConfig: OS::Heat::None OS::TripleO::Services::ContainersLogrotateCrond: deployment/logrotate/logrotate-crond-container-puppet.yaml OS::TripleO::Services::OpenShift::Master: OS::Heat::None OS::TripleO::Services::OpenShift::Worker: OS::Heat::None diff --git a/releasenotes/notes/nova-az-config-service.yaml-ed7f3846398b2291.yaml b/releasenotes/notes/nova-az-config-service.yaml-ed7f3846398b2291.yaml new file mode 100644 index 0000000000..29cfc44659 --- /dev/null +++ b/releasenotes/notes/nova-az-config-service.yaml-ed7f3846398b2291.yaml @@ -0,0 +1,9 @@ +--- +features: + - A new service, OS::TripleO::Services::NovaAZConfig, is available which can + be used to create a host aggregate and availabiity zone in Nova during the + deployment. Compute nodes in the deployment will also be added to the zone. + The zone name is set with the parameter value NovaComputeAvailabilityZone. + If let unset, it will default to the root stack name. By default the + service is mapped to None, but can be enabled by including + environments/nova-az-config.yaml.