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
This commit is contained in:
Emilien Macchi 2018-06-14 20:24:24 -07:00 committed by Alex Schultz
parent 526f39517b
commit 2a9fc8db79
3 changed files with 117 additions and 1 deletions

View File

@ -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

View File

@ -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 <<EOF >$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

View File

@ -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/<user> 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}