Graph-based upgrade-ceph. Puppet part.
- Graphs and puppet manifests part - Delete lib from .gitignore - Augeas lens for Ceph is copied and pasted, should be switched to the version from the upstream when [0] is merged and published. [0] https://github.com/hercules-team/augeas/pull/401 Change-Id: I639cbf786971fea8c56b4da6b2661477b3b12c41
This commit is contained in:
parent
7aadd4265e
commit
0af1b6517a
|
@ -13,7 +13,6 @@ var
|
|||
sdist
|
||||
develop-eggs
|
||||
.installed.cfg
|
||||
lib
|
||||
lib64
|
||||
|
||||
# Installer logs
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
# GROUPS
|
||||
- id: primary-controller
|
||||
type: group
|
||||
role: [primary-controller]
|
||||
fault_tolerance: 0
|
||||
|
||||
# TASKS
|
||||
- id: rsync_octane
|
||||
type: sync
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
parameters:
|
||||
src: rsync://{MASTER_IP}:/octane_code/puppet
|
||||
dst: /etc/fuel/octane/
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_mon_dump_create
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [rsync_octane]
|
||||
required_for: []
|
||||
parameters:
|
||||
puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/ceph_mon_dump_create.pp
|
||||
puppet_modules: /etc/fuel/octane/puppet:/etc/puppet/modules
|
||||
timeout: 360
|
||||
|
||||
- id: ceph_mon_dump_upload
|
||||
type: sync
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [ceph_mon_dump_create]
|
||||
required_for: []
|
||||
parameters:
|
||||
src: /var/tmp/ceph_mon.tar.gz
|
||||
dst: rsync://{MASTER_IP}:/octane_data/
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_etc_dump_upload
|
||||
type: sync
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [ceph_mon_dump_create]
|
||||
required_for: []
|
||||
parameters:
|
||||
src: /var/tmp/ceph_etc.tar.gz
|
||||
dst: rsync://{MASTER_IP}:/octane_data/
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_conf_upload
|
||||
type: sync
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
parameters:
|
||||
src: /etc/ceph/ceph.conf
|
||||
dst: rsync://{MASTER_IP}:/octane_data/
|
||||
timeout: 180
|
|
@ -0,0 +1,104 @@
|
|||
# GROUPS
|
||||
- id: primary-controller
|
||||
type: group
|
||||
role: [primary-controller]
|
||||
fault_tolerance: 0
|
||||
|
||||
# TASKS
|
||||
- id: rsync_octane
|
||||
type: sync
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
parameters:
|
||||
src: rsync://{MASTER_IP}:/octane_code/puppet
|
||||
dst: /etc/fuel/octane/
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_mon_dump_download
|
||||
type: sync
|
||||
version: 2.0.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
parameters:
|
||||
src: rsync://{MASTER_IP}:/octane_data/ceph_mon.tar.gz
|
||||
dst: /var/tmp
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_etc_dump_download
|
||||
type: sync
|
||||
version: 2.0.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
parameters:
|
||||
src: rsync://{MASTER_IP}:/octane_data/ceph_etc.tar.gz
|
||||
dst: /var/tmp
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_mon_conf_download
|
||||
type: sync
|
||||
version: 2.0.0
|
||||
groups: [primary-controller]
|
||||
requires: []
|
||||
required_for: []
|
||||
cross-depends:
|
||||
- name: rsync_octane_section
|
||||
role: master
|
||||
parameters:
|
||||
src: rsync://{MASTER_IP}:/octane_data/ceph.conf
|
||||
dst: /var/tmp
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_reconfiguration
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [
|
||||
rsync_octane,
|
||||
ceph_mon_conf_download,
|
||||
ceph_mon_dump_download,
|
||||
ceph_etc_dump_download,
|
||||
ceph_mon_stop
|
||||
]
|
||||
required_for: []
|
||||
parameters:
|
||||
puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/ceph_reconfiguration.pp
|
||||
puppet_modules: /etc/fuel/octane/puppet:/etc/puppet/modules
|
||||
timeout: 360
|
||||
|
||||
- id: ceph_mon_stop
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [rsync_octane]
|
||||
required_for: []
|
||||
parameters:
|
||||
puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/ceph_mon_stop.pp
|
||||
puppet_modules: /etc/fuel/octane/puppet:/etc/puppet/modules
|
||||
timeout: 180
|
||||
|
||||
- id: ceph_mon_start
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [rsync_octane,ceph_reconfiguration]
|
||||
required_for: []
|
||||
parameters:
|
||||
puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/ceph_mon_start.pp
|
||||
puppet_modules: /etc/fuel/octane/puppet:/etc/puppet/modules
|
||||
timeout: 180
|
||||
|
||||
|
||||
- id: ceph_bootstrap
|
||||
type: puppet
|
||||
version: 2.1.0
|
||||
groups: [primary-controller]
|
||||
requires: [rsync_octane,ceph_mon_start]
|
||||
required_for: []
|
||||
parameters:
|
||||
puppet_manifest: /etc/fuel/octane/puppet/octane_tasks/modular/ceph_bootstrap.pp
|
||||
puppet_modules: /etc/fuel/octane/puppet:/etc/puppet/modules
|
||||
timeout: 180
|
|
@ -0,0 +1,29 @@
|
|||
(* Ceph module for Augeas
|
||||
Author: Pavel Chechetin <pchechetin@mirantis.com>
|
||||
|
||||
ceph.conf is a standard INI File with whitespaces in the title.
|
||||
|
||||
TODO(pchechetin): Get rid of this lense when it'll be merge in the upstream.
|
||||
See also: https://github.com/hercules-team/augeas/pull/401
|
||||
|
||||
*)
|
||||
|
||||
module Ceph =
|
||||
autoload xfm
|
||||
|
||||
let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
|
||||
let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
|
||||
|
||||
let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/
|
||||
|
||||
let entry = IniFile.indented_entry entry_re sep comment
|
||||
|
||||
let title = IniFile.indented_title IniFile.record_re
|
||||
let record = IniFile.record title entry
|
||||
|
||||
let lns = IniFile.lns record comment
|
||||
|
||||
let filter = (incl "/etc/ceph/ceph.conf")
|
||||
. (incl (Sys.getenv("HOME") . "/.ceph/config"))
|
||||
|
||||
let xfm = transform lns filter
|
|
@ -0,0 +1,7 @@
|
|||
Puppet::Parser::Functions.newfunction(:ceph_get_fsid, :arity => 1, :type => :rvalue) do |args|
|
||||
require 'shellwords'
|
||||
|
||||
ceph_conf = Shellwords.escape(args[0])
|
||||
|
||||
Puppet::Util::Execution.execute("ceph-conf -c #{ceph_conf} --lookup fsid").strip
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
# == Class: octane_tasks::ceph_bootstrap
|
||||
#
|
||||
# It reconfigures a keyring of Ceph with new keys. It should be done
|
||||
# because Ceph Monitor metadata DB was transfered from the original controller
|
||||
# and new keys are not there yet.
|
||||
#
|
||||
class octane_tasks::ceph_bootstrap {
|
||||
Exec {
|
||||
provider => shell,
|
||||
}
|
||||
|
||||
exec { 'ceph.auth.import':
|
||||
command => 'ceph auth import -i /root/ceph.bootstrap-osd.keyring',
|
||||
}
|
||||
|
||||
exec { 'ceph.auth.caps':
|
||||
command => 'ceph auth caps client.bootstrap-osd mon "allow profile bootstrap-osd"',
|
||||
require => Exec['ceph.auth.import'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
# == Class: octane_tasks::ceph_mon_dump_create
|
||||
#
|
||||
# It creates a dump of Ceph Monitor database.
|
||||
#
|
||||
class octane_tasks::ceph_mon_dump_create {
|
||||
|
||||
Exec {
|
||||
provider => shell,
|
||||
}
|
||||
|
||||
exec { 'ceph_mon_dump_create':
|
||||
command => 'tar -czPf /var/tmp/ceph_mon.tar.gz *',
|
||||
cwd => "/var/lib/ceph/mon/ceph-${::hostname}",
|
||||
}
|
||||
|
||||
exec { 'ceph_etc_dump_create':
|
||||
command => 'tar -czPf /var/tmp/ceph_etc.tar.gz --exclude ceph.conf /etc/ceph',
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
# == Class: octane_tasks::ceph_mon_start
|
||||
#
|
||||
class octane_tasks::ceph_mon_start {
|
||||
service { 'ceph-mon-all': ensure => running }
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
# == Class: octane_tasks::ceph_mon_start
|
||||
#
|
||||
class octane_tasks::ceph_mon_stop {
|
||||
service { 'ceph-mon-all': ensure => stopped }
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
# == Class:octane_tasks::ceph_reconfiguration
|
||||
#
|
||||
# It replaces fsid by former fsid, using taken from the original controller ceph.conf, in:
|
||||
# - ceph.conf
|
||||
# - Ceph Monmap
|
||||
#
|
||||
class octane_tasks::ceph_reconfiguration {
|
||||
Exec {
|
||||
provider => shell,
|
||||
}
|
||||
|
||||
$orig_fsid = ceph_get_fsid('/var/tmp/ceph.conf')
|
||||
$tmp_mon_map = '/var/tmp/ceph_mon_map'
|
||||
|
||||
validate_re($orig_fsid, '\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z')
|
||||
|
||||
exec { 'extract_map':
|
||||
command => "ceph-mon -i ${::hostname} --extract-monmap ${tmp_mon_map}",
|
||||
}
|
||||
|
||||
exec { 'delete_old_mon_db':
|
||||
command => "rm -rf /var/lib/ceph/mon/ceph-${::hostname}/*",
|
||||
require => Exec['extract_map'],
|
||||
}
|
||||
|
||||
exec { 'extract_db':
|
||||
command => 'tar -xzPf /var/tmp/ceph_mon.tar.gz',
|
||||
cwd => "/var/lib/ceph/mon/ceph-${::hostname}",
|
||||
require => Exec['delete_old_mon_db'],
|
||||
}
|
||||
|
||||
exec { 'extract_ceph_etc':
|
||||
command => 'tar -xzPf /var/tmp/ceph_etc.tar.gz',
|
||||
}
|
||||
|
||||
augeas { 'ceph.conf':
|
||||
lens => 'Ceph.lns',
|
||||
incl => '/etc/ceph/ceph.conf',
|
||||
load_path => '/usr/share/augeas/lenses:/etc/fuel/octane/puppet/octane_tasks/lib/augeas/lenses',
|
||||
changes => [
|
||||
"set /files/etc/ceph/ceph.conf/global/fsid ${orig_fsid}",
|
||||
]
|
||||
}
|
||||
|
||||
exec { 'change_fsid':
|
||||
command => "monmaptool --fsid ${orig_fsid} --clobber ${tmp_mon_map}",
|
||||
require => Exec['extract_map'],
|
||||
}
|
||||
|
||||
exec { 'inject_map':
|
||||
command => "ceph-mon -i ${::hostname} --inject-monmap ${tmp_mon_map}",
|
||||
require => [
|
||||
Exec['change_fsid'],
|
||||
Augeas['ceph.conf'],
|
||||
],
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: octane_tasks::ceph_bootstrap.pp')
|
||||
|
||||
include ::octane_tasks::ceph_bootstrap
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: octane_tasks::ceph_mon_dump_create.pp')
|
||||
|
||||
include ::octane_tasks::ceph_mon_dump_create
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: octane_tasks::ceph_mon_start.pp')
|
||||
|
||||
include ::octane_tasks::ceph_mon_start
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: octane_tasks::ceph_mon_stop.pp')
|
||||
|
||||
include ::octane_tasks::ceph_mon_stop
|
|
@ -0,0 +1,3 @@
|
|||
notice('MODULAR: octane_tasks::ceph_reconfiguration.pp')
|
||||
|
||||
include ::octane_tasks::ceph_reconfiguration
|
Loading…
Reference in New Issue