SSH keys distribution and download files for vCenter

- Copy latest packages and contrail vmdk from fuel master to local
- Generate ssh key per cluster, distribute it safely to hosts

Change-Id: If175bcf3727893d2e1411297e66bee349a41ed37
This commit is contained in:
Przemysław 2016-03-30 12:38:09 +02:00 committed by Illia Polliul
parent a6c3305b71
commit c6d24df06f
6 changed files with 188 additions and 0 deletions

View File

@ -0,0 +1,19 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-vmware.pp')
include contrail
class { 'contrail::compute::vmware': }

View File

@ -0,0 +1,19 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-vmware.pp')
include contrail
class { 'contrail::controller::vmware': }

View File

@ -0,0 +1,27 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
class contrail::compute::vmware {
file{'/root/.ssh/authorized_keys':
ensure => present,
mode => '0600',
}
file_line{'vmware pub authorized keys':
path => '/root/.ssh/authorized_keys',
line => file('/var/lib/astute/vmware/vmware.pub')
}
}

View File

@ -0,0 +1,44 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
class contrail::controller::vmware {
if $::contrail::use_vcenter == true {
file {'/opt/contrail':
ensure => directory,
mode => '0755',
} ->
exec {'retrive install packages':
command => "/usr/bin/curl -fLO http://${::contrail::master_ip}:8080/plugins/contrail-3.0/latest-contrail-install-packages.deb",
creates => '/opt/contrail/contrail-install-packages.deb',
cwd => '/opt/contrail'
} ->
exec {'retrive vmware plugin packages':
command => "/usr/bin/curl -fLO http://${::contrail::master_ip}:8080/plugins/contrail-3.0/latest-contrail-install-vcenter-plugin.deb",
creates => '/opt/contrail/contrail-install-vcenter-plugin.deb',
cwd => '/opt/contrail'
} ->
exec {'retrive vmdk':
command => "/usr/bin/curl -fLO http://${::contrail::master_ip}:8080/plugins/contrail-3.0/ContrailVM-disk1.vmdk",
creates => '/opt/contrail/ContrailVM-disk1.vmdk',
cwd => '/opt/contrail'
}
}
}

View File

@ -86,6 +86,47 @@
type: parallel
# Tasks
#Overrides for generating vmware keypair
- id: copy_keys
type: copy_files
role: '*'
required_for: [pre_deployment_end]
requires: [generate_keys]
parameters:
files:
- src: /var/lib/fuel/keys/{CLUSTER_ID}/neutron/neutron.pub
dst: /var/lib/astute/neutron/neutron.pub
- src: /var/lib/fuel/keys/{CLUSTER_ID}/neutron/neutron
dst: /var/lib/astute/neutron/neutron
- src: /var/lib/fuel/keys/{CLUSTER_ID}/nova/nova.pub
dst: /var/lib/astute/nova/nova.pub
- src: /var/lib/fuel/keys/{CLUSTER_ID}/nova/nova
dst: /var/lib/astute/nova/nova
- src: /var/lib/fuel/keys/{CLUSTER_ID}/mysql/mysql.pub
dst: /var/lib/astute/mysql/mysql.pub
- src: /var/lib/fuel/keys/{CLUSTER_ID}/mysql/mysql
dst: /var/lib/astute/mysql/mysql
- src: /var/lib/fuel/keys/{CLUSTER_ID}/mongodb/mongodb.key
dst: /var/lib/astute/mongodb/mongodb.key
- src: /var/lib/fuel/keys/{CLUSTER_ID}/vmware/vmware
dst: /var/lib/astute/vmware/vmware
- src: /var/lib/fuel/keys/{CLUSTER_ID}/vmware/vmware.pub
dst: /var/lib/astute/vmware/vmware.pub
permissions: '0600'
dir_permissions: '0700'
cwd: /
- id: generate_keys
type: shell
role: master
requires: [pre_deployment_start]
required_for: [copy_keys]
parameters:
cmd: sh /etc/puppet/modules/osnailyfacter/modular/astute/generate_keys.sh -i {CLUSTER_ID} -o 'mongodb' -s 'neutron nova mysql vmware' -p /var/lib/fuel/keys/
timeout: 180
cwd: /
# Install Contrail utils, java
- id: contrail-utils
type: puppet
@ -334,6 +375,17 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 120
# Configure vmware integration
- id: openstack-controller-vmware-primary
type: puppet
role: [primary-controller]
required_for: [post_deployment_end]
requires: [controller-hiera-post]
parameters:
puppet_manifest: puppet/manifests/controller-vmware.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
# Create networks for ostf-tests and provision route target
- id: openstack-controller-provision
type: puppet
@ -372,6 +424,17 @@
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
# Deploy contrail vCenter plugin
- id: contrail-compute-vmware
type: puppet
role: [compute-vmware]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/contrail-compute-vmware.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 720
# Configures hugepages kernel settings if dpdk is enabled
- id: contrail-compute-hugepages
type: puppet

View File

@ -24,8 +24,18 @@
# - Just ./install.sh
set -ex
function relink {
LINK=$1
PACKAGE=$2
if [ -h $LINK ]; then
unlink $LINK
fi
ln -s $PACKAGE $LINK
}
PLUGIN_PATH="/var/www/nailgun/plugins/contrail-3.0"
#Now uses the latest package file
UBUNTU_PKG=`find $PLUGIN_PATH -maxdepth 1 -name 'contrail-install-packages*.deb' -exec stat -c "%y %n" {} + | sort -r | head -n 1 | cut -d' ' -f 4`
@ -46,6 +56,12 @@ fi
if [ -f "$UBUNTU_PKG" ];
then
#Create link to latest version of contrail package
relink $PLUGIN_PATH/latest-contrail-install-packages.deb $UBUNTU_PKG
#Create link to latest version of contrail vcenter plugin package
relink $PLUGIN_PATH/latest-contrail-install-vcenter-plugin.deb $VMWARE_PKG
DEB=`mktemp -d`
dpkg -x $UBUNTU_PKG $DEB
cd $PLUGIN_PATH/repositories/ubuntu/