Simplify satellite registration

This simplifies satellite registration by making use of the provided
resource registry from tripleo-heat-templates directly for
rhel-registration, thus avoiding the need to reload everything into
tuskar.

Requires a tripleo-heat-templates that has this commit:
https://review.openstack.org/#/c/172065/11

Change-Id: I45c2edda88f92c0b2df560e2febca1a7a476ee96
This commit is contained in:
James Slagle 2015-04-29 16:18:20 -04:00
parent e48dd7a632
commit 9205000519
2 changed files with 29 additions and 60 deletions

View File

@ -1,26 +0,0 @@
resource_registry:
OS::TripleO::BlockStorage: puppet/cinder-storage-puppet.yaml
OS::TripleO::BlockStorage::Net::SoftwareConfig: net-config-noop.yaml
OS::TripleO::Compute: puppet/compute-puppet.yaml
OS::TripleO::Compute::Net::SoftwareConfig: net-config-bridge.yaml
OS::TripleO::SoftwareDeployment: OS::Heat::StructuredDeployment
OS::TripleO::Controller: puppet/controller-puppet.yaml
OS::TripleO::Controller::Net::SoftwareConfig: net-config-bridge.yaml
OS::TripleO::ObjectStorage: puppet/swift-storage-puppet.yaml
OS::TripleO::ObjectStorage::Net::SoftwareConfig: net-config-noop.yaml
OS::TripleO::CephStorage: puppet/ceph-storage-puppet.yaml
OS::TripleO::CephStorage::Net::SoftwareConfig: net-config-noop.yaml
OS::TripleO::ControllerPostDeployment: puppet/controller-post-puppet.yaml
OS::TripleO::ComputePostDeployment: puppet/compute-post-puppet.yaml
OS::TripleO::ObjectStoragePostDeployment: puppet/swift-storage-post.yaml
OS::TripleO::BlockStoragePostDeployment: puppet/cinder-storage-post.yaml
OS::TripleO::CephStoragePostDeployment: puppet/ceph-storage-post-puppet.yaml
OS::TripleO::SwiftDevicesAndProxy::SoftwareConfig: puppet/swift-devices-and-proxy-config.yaml
OS::TripleO::CephClusterConfig::SoftwareConfig: puppet/ceph-cluster-config.yaml
OS::TripleO::AllNodes::SoftwareConfig: puppet/all-nodes-config.yaml
OS::TripleO::BootstrapNode::SoftwareConfig: puppet/bootstrap-config.yaml
OS::TripleO::NodeUserData: firstboot/userdata_default.yaml
OS::TripleO::NodeExtraConfigPost: extraconfig/post_deploy/example_rhel_reg.yaml
parameter_defaults:
EnablePackageInstall: false

View File

@ -121,18 +121,35 @@ export REG_ORG=${REG_ORG:-"''"}
export REG_FORCE=${REG_FORCE:-"1"}
export REG_SAT_URL=${REG_SAT_URL:-"''"}
export REG_METHOD=${REG_METHOD:-"''"}
# The modified resource registry must exist under
# /usr/share/openstack-tripleo-heat-templates for Tuskar's sake.
sudo cp /usr/share/instack-undercloud/heat-templates/overcloud-resource-registry-puppet-satellite.yaml \
/usr/share/openstack-tripleo-heat-templates
if [ "$REG_METHOD" = "satellite" ]; then
export OVERCLOUD_RESOURCE_REGISTRY=${OVERCLOUD_RESOURCE_REGISTRY:-"/usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet-satellite.yaml"}
else
export OVERCLOUD_RESOURCE_REGISTRY=${OVERCLOUD_RESOURCE_REGISTRY:-"/usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet.yaml"}
fi
export OVERCLOUD_RESOURCE_REGISTRY=${OVERCLOUD_RESOURCE_REGISTRY:-"/usr/share/openstack-tripleo-heat-templates/overcloud-resource-registry-puppet.yaml"}
NeutronControlPlaneID=$(neutron net-show ctlplane | grep ' id ' | awk '{print $4}')
# $OVERCLOUD_EXTRA is for passing any additional arbitrary options to heat
# stack-{create,update}
export OVERCLOUD_EXTRA=${OVERCLOUD_EXTRA:-""}
if [ "$REG_METHOD" = "satellite" ]; then
export OVERCLOUD_SATELLITE_ENV=${OVERCLOUD_SATELLITE_ENV:-overcloud-env-satellite.json}
if [ -f $OVERCLOUD_SATELLITE_ENV ]; then
SATELLITE_ENV_JSON=$(cat $OVERCLOUD_SATELLITE_ENV)
else
SATELLITE_ENV_JSON="{}"
fi
SATELLITE_ENV_JSON=$(jq ".parameter_defaults.rhel_reg_activation_key = \"$REG_ACTIVATION_KEY\"" <<< $SATELLITE_ENV_JSON)
SATELLITE_ENV_JSON=$(jq ".parameter_defaults.rhel_reg_sat_url = \"$REG_SAT_URL\"" <<< $SATELLITE_ENV_JSON)
SATELLITE_ENV_JSON=$(jq ".parameter_defaults.rhel_reg_org = \"$REG_ORG\"" <<< $SATELLITE_ENV_JSON)
SATELLITE_ENV_JSON=$(jq ".parameter_defaults.rhel_reg_method = \"$REG_METHOD\"" <<< $SATELLITE_ENV_JSON)
SATELLITE_ENV_JSON=$(jq ".parameter_defaults.rhel_reg_force = \"$REG_FORCE\"" <<< $SATELLITE_ENV_JSON)
echo $SATELLITE_ENV_JSON > $OVERCLOUD_SATELLITE_ENV
export OVERCLOUD_EXTRA="$OVERCLOUD_EXTRA -e /usr/share/openstack-tripleo-heat-templates/extraconfig/post_deploy/rhel-registration/rhel-registration-resource-registry.yaml"
export OVERCLOUD_EXTRA="$OVERCLOUD_EXTRA -e /usr/share/openstack-tripleo-heat-templates/extraconfig/post_deploy/rhel-registration/environment-rhel-registration.yaml"
export OVERCLOUD_EXTRA="$OVERCLOUD_EXTRA -e $OVERCLOUD_SATELLITE_ENV"
fi
# NOTE(gfidente): Taken from
# https://github.com/ceph/ceph-deploy/blob/master/ceph_deploy/new.py#L21
function create_cephx_key() {
@ -142,11 +159,6 @@ function create_cephx_key() {
if [ -n "$TUSKAR" ]; then
# Reload the tuskar resource registry that includes the satellite
# registration resource.
export TUSKAR_RESOURCE_REGISTRY=$OVERCLOUD_RESOURCE_REGISTRY
sudo -E /usr/libexec/os-refresh-config/configure.d/90-tuskar-db-sync
PLAN_ID=$(tuskar plan-show overcloud | awk '$2=="uuid" {print $4}')
if [ -n "$PLAN_ID" ]; then
tuskar plan-delete $PLAN_ID
@ -304,21 +316,9 @@ if [ -n "$TUSKAR" ]; then
OVERCLOUD_YAML_PATH="tuskar_templates/plan.yaml"
ENVIRONMENT_YAML_PATH="tuskar_templates/environment.yaml"
if [ "$REG_METHOD" = "satellite" ]; then
mkdir -p tuskar_templates/extraconfig/post_deploy
cp -r /usr/share/openstack-tripleo-heat-templates/extraconfig/post_deploy/scripts tuskar_templates/extraconfig/post_deploy
echo "parameter_defaults:" >> $ENVIRONMENT_YAML_PATH
echo " rhel_reg_activation_key: $REG_ACTIVATION_KEY" >> $ENVIRONMENT_YAML_PATH
echo " rhel_reg_sat_url: $REG_SAT_URL" >> $ENVIRONMENT_YAML_PATH
echo " rhel_reg_org: $REG_ORG" >> $ENVIRONMENT_YAML_PATH
echo " rhel_reg_method: $REG_METHOD" >> $ENVIRONMENT_YAML_PATH
echo " rhel_reg_force: $REG_FORCE" >> $ENVIRONMENT_YAML_PATH
fi
heat $HEAT_OP -t $TIMEOUT -f $OVERCLOUD_YAML_PATH \
-e $ENVIRONMENT_YAML_PATH \
$OVERCLOUD_EXTRA \
overcloud
else
@ -414,12 +414,6 @@ else
"ObjectStorageCount": '${SWIFTSTORAGESCALE}'
}' <<< $ENV_JSON)
ENV_JSON=$(jq ".parameter_defaults.rhel_reg_activation_key = \"$REG_ACTIVATION_KEY\"" <<< $ENV_JSON)
ENV_JSON=$(jq ".parameter_defaults.rhel_reg_sat_url = \"$REG_SAT_URL\"" <<< $ENV_JSON)
ENV_JSON=$(jq ".parameter_defaults.rhel_reg_org = \"$REG_ORG\"" <<< $ENV_JSON)
ENV_JSON=$(jq ".parameter_defaults.rhel_reg_method = \"$REG_METHOD\"" <<< $ENV_JSON)
ENV_JSON=$(jq ".parameter_defaults.rhel_reg_force = \"$REG_FORCE\"" <<< $ENV_JSON)
jq . > "${HEAT_ENV}" <<< $ENV_JSON
chmod 0600 "${HEAT_ENV}"
@ -433,6 +427,7 @@ else
$RESOURCE_REGISTRY \
$OVERCLOUD_PARAMETERS \
$HEAT_ENVIRONMENT \
$OVERCLOUD_EXTRA \
overcloud
fi