Merge "Added puppet manifests and tasks descrition files"
This commit is contained in:
commit
db07e434db
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# It's a script which deploys your plugin
|
||||
echo fuel-plugin-cinder-gcs > /tmp/fuel-plugin-cinder-gcs
|
|
@ -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:gcs_conf.pp')
|
||||
include gcs
|
||||
class { 'gcs::config': }
|
||||
class { 'gcs::package_utils': }
|
||||
class { 'gcs::services': }
|
|
@ -0,0 +1,55 @@
|
|||
# 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 gcs::config (
|
||||
$backup_driver = $gcs::backup_driver,
|
||||
$backup_gcs_bucket = $gcs::settings['backup_gcs_bucket'],
|
||||
$backup_gcs_project_id = $gcs::settings['backup_gcs_project_id'],
|
||||
$backup_gcs_bucket_location = $gcs::settings['backup_gcs_bucket_location'],
|
||||
$backup_gcs_enable_progress_timer = $gcs::settings['backup_gcs_enable_progress_timer'],
|
||||
$backup_gcs_storage_class = $gcs::settings['backup_gcs_storage_class'],
|
||||
$backup_gcs_block_size = $gcs::settings['backup_gcs_block_size'],
|
||||
$backup_gcs_object_size = $gcs::settings['backup_gcs_object_size'],
|
||||
$backup_gcs_user_agent = $gcs::settings['backup_gcs_user_agent'],
|
||||
$backup_gcs_writer_chunk_size = $gcs::settings['backup_gcs_writer_chunk_size'],
|
||||
$backup_gcs_reader_chunk_size = $gcs::settings['backup_gcs_reader_chunk_size'],
|
||||
$backup_gcs_num_retries = $gcs::settings['backup_gcs_num_retries'],
|
||||
$backup_gcs_retry_error_codes = $gcs::settings['backup_gcs_retry_error_codes'],
|
||||
$backup_gcs_credential_file = $gcs::credential_file,
|
||||
) {
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/backup_driver': value => $backup_driver;
|
||||
'DEFAULT/backup_gcs_bucket': value => $backup_gcs_bucket;
|
||||
'DEFAULT/backup_gcs_project_id': value => $backup_gcs_project_id;
|
||||
'DEFAULT/backup_gcs_credentials_file': value => $backup_gcs_credentials_file;
|
||||
'DEFAULT/backup_gcs_bucket_location': value => $backup_gcs_bucket_location;
|
||||
'DEFAULT/backup_gcs_enable_progress_timer': value => $backup_gcs_enable_progress_timer;
|
||||
'DEFAULT/backup_gcs_storage_class': value => $backup_gcs_storage_class;
|
||||
'DEFAULT/backup_gcs_user_agent': value => $backup_gcs_user_agent;
|
||||
'DEFAULT/backup_gcs_credential_file': value => $backup_gcs_credential_file;
|
||||
'DEFAULT/backup_gcs_block_size': value => $backup_gcs_block_size;
|
||||
'DEFAULT/backup_gcs_object_size': value => $backup_gcs_object_size;
|
||||
'DEFAULT/backup_gcs_writer_chunk_size': value => $backup_gcs_writer_chunk_size;
|
||||
'DEFAULT/backup_gcs_reader_chunk_size': value => $backup_gcs_reader_chunk_size;
|
||||
'DEFAULT/backup_gcs_retry_error_codes': value => $backup_gcs_retry_error_codes;
|
||||
'DEFAULT/backup_gcs_num_retries': value => $backup_gcs_num_retries;
|
||||
}
|
||||
file { $backup_gcs_credential_file:
|
||||
owner => 'cinder',
|
||||
group => 'cinder',
|
||||
content => template('gcs/credentials.json.erb'),
|
||||
mode => '0600',
|
||||
}
|
||||
}
|
|
@ -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 gcs {
|
||||
$services = 'cinder-backup'
|
||||
$plugin_hash = hiera_hash('fuel-plugin-cinder-gcs')
|
||||
$backup_driver = 'cinder.backup.drivers.google'
|
||||
$user_agent = 'gcscinder'
|
||||
$credential_file = '/var/lib/cinder/credentials.json'
|
||||
$pip_packages = ['google-api-python-client']
|
||||
$python_package_provider = ['python-pip']
|
||||
|
||||
if $plugin_hash['backup_gcs_advanced_settings'] {
|
||||
$settings = $plugin_hash
|
||||
}
|
||||
else {
|
||||
$settings = {
|
||||
backup_gcs_bucket => $plugin_hash['backup_gcs_bucket'],
|
||||
backup_gcs_project_id => $plugin_hash['backup_gcs_project_id'],
|
||||
backup_gcs_bucket_location => $plugin_hash['backup_gcs_bucket_location'],
|
||||
backup_gcs_storage_class => $plugin_hash['backup_gcs_storage_class'],
|
||||
gcs_private_key_id => $plugin_hash['gcs_private_key_id'],
|
||||
gcs_private_key => $plugin_hash['gcs_private_key'],
|
||||
gcs_client_email => $plugin_hash['gcs_client_email'],
|
||||
gcs_client_id => $plugin_hash['gcs_client_id'],
|
||||
gcs_auth_uri => $plugin_hash['gcs_auth_uri'],
|
||||
gcs_token_uri => $plugin_hash['gcs_token_uri'],
|
||||
gcs_auth_provider_x509_cert_url => $plugin_hash['gcs_auth_provider_x509_cert_url'],
|
||||
gcs_client_x509_cert_url => $plugin_hash['gcs_client_x509_cert_url'],
|
||||
gcs_account_type => $plugin_hash['gcs_account_type']
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
# 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 gcs::package_utils (
|
||||
$action = 'install',
|
||||
$packages = $gcs::packages,
|
||||
$pip_packages = $gcs::pip_packages,
|
||||
$pip_flags = '',
|
||||
$python_package_provider = $gcs::python_package_provider,
|
||||
) {
|
||||
|
||||
define gcs::package_utils::exec_pip (
|
||||
$pip_action = $gcs::package_utils::action,
|
||||
$flags = $gcs::package_utils::flags,
|
||||
) {
|
||||
exec { "pip_install_${name}":
|
||||
command => "pip ${pip_action} ${flags} ${name}",
|
||||
provider => shell,
|
||||
path => '/usr/local/bin:/usr/bin:/bin'
|
||||
}
|
||||
}
|
||||
package { $python_package_provider:
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
case $action {
|
||||
'install': {
|
||||
if ($packages) {
|
||||
package { $packages:
|
||||
ensure => installed,
|
||||
}
|
||||
}
|
||||
if ($pip_packages) {
|
||||
gcs::package_utils::exec_pip { $pip_packages:
|
||||
flags => '-U',
|
||||
require => Package[$python_package_provider],
|
||||
}
|
||||
}
|
||||
}
|
||||
'uninstall': {
|
||||
if ($packages) {
|
||||
package { $packages:
|
||||
ensure => purged,
|
||||
}
|
||||
}
|
||||
if ($pip_packages) {
|
||||
package { $pip_packages:
|
||||
ensure => absent,
|
||||
provider => pip,
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
fail("Option ${action} is not supported by class package_utils")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
# 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 gcs::services {
|
||||
$services = $gcs::services
|
||||
service { $services: ensure => running }
|
||||
Cinder_config <||> ~> Service[$services]
|
||||
Class['gcs::package_utils'] ~> Service[$services]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<% @settings = scope.lookupvar('gcs::settings') -%>
|
||||
{
|
||||
"type": "<%= @settings['backup_gcs_account_type'] %>",
|
||||
"project_id": "<%= @settings['gcs_project_id'] %>",
|
||||
"private_key": "<%= @settings['gcs_private_key'] %>",
|
||||
"private_key_id": "<%= @settings['gcs_private_key_id'] %>",
|
||||
"client_email": "<%= @settings['gcs_client_email'] %>",
|
||||
"client_id": "<%= @settings['gcs_client_id'] %>",
|
||||
"auth_uri": "<%= @settings['gcs_auth_uri'] %>",
|
||||
"token_uri": "<%= @settings['gcs_token_uri'] %>",
|
||||
"auth_provider_x509_cert_url": "<%= @settings['gcs_auth_provider_x509_cert_url'] %>",
|
||||
"client_x509_cert_url": "<%= @settings['gcs_client_x509_cert_url'] %>"
|
||||
}
|
|
@ -1,62 +1,14 @@
|
|||
# These tasks will be merged into deployment graph. Here you
|
||||
# can specify new tasks for any roles, even built-in ones.
|
||||
|
||||
- id: fuel-plugin-cinder-gcs_role
|
||||
type: group
|
||||
role: [fuel-plugin-cinder-gcs_role]
|
||||
parameters:
|
||||
strategy:
|
||||
type: parallel
|
||||
|
||||
- id: fuel-plugin-cinder-gcs-deployment-puppet
|
||||
- id: gcs_config
|
||||
type: puppet
|
||||
role: [fuel-plugin-cinder-gcs_role]
|
||||
|
||||
# If you do not want to use task-based deployment that is introduced as experimental
|
||||
# in fuel v8.0 comment code section below this comment, uncomment two lines below it
|
||||
# and do the same for tasks below.
|
||||
|
||||
role: ['primary-controller','controller','cinder']
|
||||
requires: [deploy_start]
|
||||
version: 2.0.0
|
||||
cross-depends:
|
||||
- name: deploy_start
|
||||
cross-depended-by:
|
||||
- name: deploy_end
|
||||
# requires: [deploy_start] # version 1.0.0
|
||||
# required_for: [deploy_end]
|
||||
|
||||
- name: /.*cinder.*/
|
||||
role: self
|
||||
parameters:
|
||||
puppet_manifest: "deploy.pp"
|
||||
puppet_modules: "."
|
||||
timeout: 3600
|
||||
|
||||
#- id: fuel-plugin-cinder-gcs-post-deployment-sh
|
||||
# type: shell
|
||||
# role: [fuel-plugin-cinder-gcs_role]
|
||||
# version: 2.0.0
|
||||
# cross-depends:
|
||||
# - name: post_deployment_start
|
||||
# cross-depended-by:
|
||||
# - name: post_deployment_end
|
||||
# # requires: [post_deployment_start]
|
||||
# # required_for: [post_deployment_end]
|
||||
# parameters:
|
||||
# cmd: echo post_deployment_task_executed > /tmp/post_deployment
|
||||
# retries: 3
|
||||
# interval: 20
|
||||
# timeout: 180
|
||||
|
||||
#- id: fuel-plugin-cinder-gcs-pre-deployment-sh
|
||||
# type: shell
|
||||
# role: [fuel-plugin-cinder-gcs_role]
|
||||
# version: 2.0.0
|
||||
# cross-depends:
|
||||
# - name: pre_deployment_start
|
||||
# cross-depended-by:
|
||||
# - name: pre_deployment_end
|
||||
# # requires: [pre_deployment_start]
|
||||
# # required_for: [pre_deployment_end]
|
||||
# parameters:
|
||||
# cmd: echo pre_deployment_task_executed > /tmp/pre_deployment
|
||||
# retries: 3
|
||||
# interval: 20
|
||||
# timeout: 180
|
||||
puppet_manifest: puppet/manifests/gcs_conf.pp
|
||||
puppet_modules: puppet/modules:/etc/puppet/modules
|
||||
timeout: 300
|
||||
condition:
|
||||
yaql_exp: $.storage.volumes_ceph or ('cinder' in $.roles )
|
||||
|
|
Loading…
Reference in New Issue