From e6e9575e27da7978b2418c1b88aa24bda9d532ab Mon Sep 17 00:00:00 2001 From: Igor Gajsin Date: Mon, 1 Aug 2016 16:15:29 +0300 Subject: [PATCH] add init files Change-Id: I923289f414643124b353db14ada8bcb75f02577f --- .../puppet/manifests/install.pp | 17 ++++++++++ .../modules/manila_auxiliary/manifests/fs.pp | 31 ++++++++++++++++--- .../manila_auxiliary/manifests/init.pp | 3 +- .../manila_auxiliary/manifests/initd.pp | 23 ++++++++++++++ .../manila_auxiliary/templates/init.erb | 18 +++++++++++ 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 deployment_scripts/puppet/modules/manila_auxiliary/manifests/initd.pp create mode 100644 deployment_scripts/puppet/modules/manila_auxiliary/templates/init.erb diff --git a/deployment_scripts/puppet/manifests/install.pp b/deployment_scripts/puppet/manifests/install.pp index 2a6c7a6..9e362e0 100644 --- a/deployment_scripts/puppet/manifests/install.pp +++ b/deployment_scripts/puppet/manifests/install.pp @@ -1,5 +1,20 @@ notify {'MODULAR: fuel-plugin-manila/install': } +$inits = { + 'manila-api' => { + 'desc' => 'manila-api init', + 'srv' => 'manila-api',}, + 'manila-share' => { + 'desc' => 'manila-share init', + 'srv' => 'manila-share',}, + 'manila-data' =>{ + 'desc' => 'manila-data init', + 'srv ' => 'manila-data',}, + 'manila-scheduler' => { + 'desc' => 'manila-scheduler init', + 'srv' => 'manila-scheduler',}, +} + package {'python-pip': ensure => 'installed' } @@ -23,4 +38,6 @@ package {'python-manila-ui': class{'::manila_auxiliary::fs': } +create_resource('::manila_auxiliary::initd', $inits) + Package['python-pip']->Package['pycrypto']->Package['python-manila']->Package['python-manilaclient']->Package['python-manila-ui'] diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp index 451da2c..ee5685b 100644 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/fs.pp @@ -1,26 +1,47 @@ class manila_auxiliary::fs () { + + user {'manila': + ensure => 'present', + system => true, + }-> file {'/etc/manila': ensure => 'directory', + owner => 'manila', + group => 'manila', }-> file {'/etc/manila/rootwrap.d': ensure => 'directory', + owner => 'manila', + group => 'manila', } file { '/var/log/manila': ensure => 'directory', + owner => 'manila', + group => 'manila', } file {'/etc/manila/api-paste.ini': - source => "puppet:///modules/manila_auxiliary/api-paste.ini", + source => 'puppet:///modules/manila_auxiliary/api-paste.ini', + owner => 'manila', + group => 'manila', } file {'/etc/manila/logging_sample.conf': - source => "puppet:///modules/manila_auxiliary/logging_sample.conf", + source => 'puppet:///modules/manila_auxiliary/logging_sample.conf', + owner => 'manila', + group => 'manila', } file {'/etc/manila/policy.json': - source => "puppet:///modules/manila_auxiliary/policy.json", + source => 'puppet:///modules/manila_auxiliary/policy.json', + owner => 'manila', + group => 'manila', } file {'/etc/manila/rootwrap.conf': - source => "puppet:///modules/manila_auxiliary/rootwrap.conf", + source => 'puppet:///modules/manila_auxiliary/rootwrap.conf', + owner => 'manila', + group => 'manila', } file {'/etc/manila/rootwrap.d/share.filters': - source => "puppet:///modules/manila_auxiliary/share.filters" + source => 'puppet:///modules/manila_auxiliary/share.filters', + owner => 'manila', + group => 'manila', } } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp index 0211963..01dca4e 100644 --- a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/init.pp @@ -42,7 +42,6 @@ # # Copyright 2016 Your name here, unless otherwise noted. # -class manila_auxiliary { - +class manila_auxiliary () { } diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/manifests/initd.pp b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/initd.pp new file mode 100644 index 0000000..f64087c --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/manifests/initd.pp @@ -0,0 +1,23 @@ +# 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. + +define manila_auxiliary::initd( + $desc = 'some manila init script', + $srv = 'manila-something', +){ + file {"/etc/init/${srv}.conf": + ensure => present, + content => template('manila_auxiliary/init.erb') + } +} diff --git a/deployment_scripts/puppet/modules/manila_auxiliary/templates/init.erb b/deployment_scripts/puppet/modules/manila_auxiliary/templates/init.erb new file mode 100644 index 0000000..2c642ec --- /dev/null +++ b/deployment_scripts/puppet/modules/manila_auxiliary/templates/init.erb @@ -0,0 +1,18 @@ +description "<%= @desc %>" +author "Igor Gajsin " + +start on runlevel [2345] +stop on runlevel [!2345] + +chdir /var/run + +pre-start script + mkdir -p /var/run/manila + chown manila:manila /var/run/manila + + mkdir -p /var/lock/manila + chown manila:root /var/lock/manila +end script + +exec start-stop-daemon --start --chuid manila --exec /usr/bin/<%= @srv %> \ + -- --config-file=/etc/manila/manila.conf --log-file=/var/log/manila/<%= @srv %>.log \ No newline at end of file