From 2a9fc8db79fc0ec037ef45cd37e8b1dbf8bdfd08 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Thu, 14 Jun 2018 20:24:24 -0700 Subject: [PATCH] standalone run a post config to generate a clouds.yaml Implement a post script for the standalone to generate a basic clouds.yaml for use with various tools. This one does not reuse the undercloud post because the undercloud script performs a bunch of undercloud specific functions. Change-Id: I0496f4dd2026ab6c705683126c8f50302a0861b9 --- environments/standalone.yaml | 2 +- extraconfig/post_deploy/standalone_post.sh | 26 ++++++ extraconfig/post_deploy/standalone_post.yaml | 90 ++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100755 extraconfig/post_deploy/standalone_post.sh create mode 100644 extraconfig/post_deploy/standalone_post.yaml diff --git a/environments/standalone.yaml b/environments/standalone.yaml index 657335bc94..3a35c11669 100644 --- a/environments/standalone.yaml +++ b/environments/standalone.yaml @@ -2,7 +2,7 @@ resource_registry: OS::TripleO::Network::Ports::RedisVipPort: ../network/ports/noop.yaml OS::TripleO::Network::Ports::ControlPlaneVipPort: ../deployed-server/deployed-neutron-port.yaml OS::TripleO::Standalone::Net::SoftwareConfig: ../net-config-standalone.yaml - OS::TripleO::NodeExtraConfigPost: OS::Heat::None + OS::TripleO::NodeExtraConfigPost: ../extraconfig/post_deploy/standalone_post.yaml # Disable non-openstack services that are enabled by default OS::TripleO::Services::HAproxy: OS::Heat::None diff --git a/extraconfig/post_deploy/standalone_post.sh b/extraconfig/post_deploy/standalone_post.sh new file mode 100755 index 0000000000..8bc97501ee --- /dev/null +++ b/extraconfig/post_deploy/standalone_post.sh @@ -0,0 +1,26 @@ +#!/bin/bash +set -eux + +ln -sf /etc/puppet/hiera.yaml /etc/hiera.yaml + +HOMEDIR="$homedir" + +# write out clouds.yaml + +mkdir -p $HOMEDIR/.config/openstack +touch $HOMEDIR/.config/openstack/clouds.yaml +chown 600 $HOMEDIR/.config/openstack/clouds.yaml +cat <$HOMEDIR/.config/openstack/clouds.yaml +clouds: + $cloud_name: + auth: + auth_url: $auth_url + project_name: admin + username: admin + password: $admin_password + region_name: $region_name + identity_api_version: 3 + cloud: standalone +EOF + + diff --git a/extraconfig/post_deploy/standalone_post.yaml b/extraconfig/post_deploy/standalone_post.yaml new file mode 100644 index 0000000000..4b39b10851 --- /dev/null +++ b/extraconfig/post_deploy/standalone_post.yaml @@ -0,0 +1,90 @@ +heat_template_version: rocky + +description: > + Post-deployment for the TripleO standalone deployment + +parameters: + servers: + type: json + DeployedServerPortMap: + default: {} + type: json + UndercloudHomeDir: + description: The HOME directory where the stackrc and ssh credentials for the Undercloud will be installed. Set to /home/ to customize the location. + type: string + default: '/root' + AdminPassword: #supplied by tripleo-undercloud-passwords.yaml + type: string + description: The password for the keystone admin account, used for monitoring, querying neutron etc. + hidden: True + SSLCertificate: + description: > + The content of the SSL certificate (without Key) in PEM format. + type: string + default: "" + hidden: True + PublicSSLCertificateAutogenerated: + default: false + description: > + Whether the public SSL certificate was autogenerated or not. + type: boolean + KeystoneRegion: + type: string + default: 'regionOne' + description: Keystone region for endpoint + StandaloneCloudName: + type: string + default: 'standalone' + description: Cloud name for the clouds.yaml + +conditions: + + tls_enabled: + or: + - not: + equals: + - {get_param: SSLCertificate} + - "" + - equals: + - {get_param: PublicSSLCertificateAutogenerated} + - true + +resources: + + StandalonePostConfig: + type: OS::Heat::SoftwareConfig + properties: + group: script + inputs: + - name: admin_password + - name: auth_url + - name: cloud_name + - name: homedir + - name: region_name + config: {get_file: ./standalone_post.sh} + + StandalonePostDeployment: + type: OS::Heat::SoftwareDeployments + properties: + name: StandalonePostDeployment + servers: {get_param: servers} + config: {get_resource: StandalonePostConfig} + input_values: + admin_password: {get_param: AdminPassword} + # if SSL is enabled we use the public virtual ip as the stackrc endpoint + auth_url: + if: + - tls_enabled + - make_url: + scheme: https + host: {get_param: [DeployedServerPortMap, 'public_virtual_ip', fixed_ips, 0, ip_address]} + port: 13000 + path: / + - make_url: + scheme: http + host: {get_param: [DeployedServerPortMap, 'control_virtual_ip', fixed_ips, 0, ip_address]} + port: 5000 + path: / + cloud_name: {get_param: StandaloneCloudName} + homedir: {get_param: UndercloudHomeDir} + region_name: {get_param: KeystoneRegion}