Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ceph: Add examples and usable templates for ceph #29

Merged
merged 4 commits into from May 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions clusters/ceph_cluster/profiles/ceph01.example.org.pan
@@ -0,0 +1,8 @@
object template ceph01.example.org;

include 'machine-types/ceph-server';

#
# software repositories (should be last)
#
include { PKG_REPOSITORY_CONFIG };
8 changes: 8 additions & 0 deletions clusters/ceph_cluster/profiles/ceph02.example.org.pan
@@ -0,0 +1,8 @@
object template ceph02.example.org;

include 'machine-types/ceph-server';

#
# software repositories (should be last)
#
include { PKG_REPOSITORY_CONFIG };
8 changes: 8 additions & 0 deletions clusters/ceph_cluster/profiles/ceph03.example.org.pan
@@ -0,0 +1,8 @@
object template ceph03.example.org;

include 'machine-types/ceph-server';

#
# software repositories (should be last)
#
include { PKG_REPOSITORY_CONFIG };
15 changes: 15 additions & 0 deletions clusters/ceph_cluster/site/ceph/cluster/params.pan
@@ -0,0 +1,15 @@
unique template site/ceph/cluster/params;

final variable CEPH_DEPLOY_PUBKEYS = list(
);

variable CEPH_NODES = list('ceph01.example.org', 'ceph02.example.org', 'ceph03.example.org');
variable CEPH_CLUSTER_TEMPLATE = 'building';

variable MDS_FQDNS = list('ceph01.example.org', 'ceph02.example.org');
variable DEPLOY_FQDNS = list(CEPH_NODES[0]);

variable CEPH_FSID = '230b20a6-f0ea-4d4e-bdc5-b751005ef6d8';
variable CEPH_NETWORK = '10.20.30.0/24';
variable CEPH_CLUSTER_NETWORK = CEPH_NETWORK;

5 changes: 5 additions & 0 deletions clusters/ceph_cluster/site/ceph/common/params.pan
@@ -0,0 +1,5 @@
unique template site/ceph/common/params;

final variable CEPH_VERSION = '9.2.0';

final variable CEPH_MON_HOSTS = list("ceph01.example.org", "ceph02.example.org", "ceph03.example.org");
21 changes: 21 additions & 0 deletions clusters/ceph_cluster/site/filesystems/ceph.pan
@@ -0,0 +1,21 @@
unique template site/filesystems/ceph;


variable MAKE_SEPERATE_VAR_PART = true;
include 'site/filesystems/ceph-common';

prefix '/system/blockdevices';
# Boot disk sda partitions
'partitions' = {
partitions_add(
'sda', dict('sda1', 1*GB,
'sda2', 10*GB,
'sda3', DISK_SWAP_SIZE,
'sda4', 1*MB, #biosboot
'sda5', 30*GB,
'sda6', -1));
SELF['sda4']['flags'] = dict("bios_grub", true);
SELF;
};

include 'site/filesystems/ceph-basic';
28 changes: 28 additions & 0 deletions sites/example/machine-types/ceph-server.pan
@@ -0,0 +1,28 @@
unique template machine-types/ceph-server;

variable MACHINETYPE_TOP_INSTANCE ?= 'ceph-server';

include 'machine-types/pre/ceph-server';

include 'machine-types/base';

include { format('site/ceph/%s/config', CEPH_CLUSTER_TEMPLATE) } ;

"/system/monitoring/hostgroups" = {
append("ceph-servers");
if (index(OBJECT,CEPH_MON_HOSTS) >= 0){
append("ceph-mons");
};
SELF;
};

include {
if (CEPH_MAJOR_VERSION >= 9) {
'site/ceph/server/infernalis';
};
};
include { if_exists('site/ceph/cluster/extra_config')};
include {if (MACHINETYPE_TOP_INSTANCE == 'ceph-server') {
'machine-types/post/ceph-server'; # Else this should be included on higer level
};
};
17 changes: 17 additions & 0 deletions sites/example/machine-types/pre/ceph-server.pan
@@ -0,0 +1,17 @@
unique template machine-types/pre/ceph-server;

variable AII_OSINSTALL_CLEARPART_BOOT_ONLY ?= true;

variable FILESYSTEM_LAYOUT_CONFIG_SITE ?= 'site/filesystems/ceph';
final variable CEPH_CLIENT_SET_CONFIG = false; # Do not overwrite ceph-server config

variable FSTAB_PROTECTED_EXTRA_FSTYPES ?= append('xfs');

variable ETCHOSTS_TYPE ?= 'local';

variable CEPH_CLUSTER_TEMPLATE ?= 'basic';

variable CEPH_OSD_MP_BASE = '/var/lib/ceph/osd/';
# Include specific parameters, like filesystem layout
include 'site/ceph/cluster/params';

56 changes: 56 additions & 0 deletions sites/example/site/ceph/basic/cluster.pan
@@ -0,0 +1,56 @@
unique template site/ceph/basic/cluster;

variable CEPH_HOSTS = shorten_fqdns(CEPH_NODES);

include 'site/ceph/common/ceph-deploy';

prefix '/software/components/ceph';
'deploy_version' = CEPH_DEPLOY_VERSION;
'ceph_version' = CEPH_VERSION;

variable CEPH_OSD_LIST ?= 'site/ceph/basic/osdlist-simple';
include {CEPH_OSD_LIST } ;

variable CEPH_OSD_SCHEMA ?= 'osds-simple';
include {format('site/ceph/osdschemas/%s', CEPH_OSD_SCHEMA)};
include 'site/ceph/basic/mons';
include 'site/ceph/basic/mdss';
include 'site/ceph/basic/deploy';

prefix '/software/components/ceph/clusters/ceph';

variable CEPH_GLOBAL_CONFIG_EXTRA ?= nlist();
variable CEPH_ENABLE_EXP ?= list();
variable CEPH_OSD_DOWN_REPORTERS ?= false;
variable CEPH_OSD_DOWN_REPORTS ?= false;


variable CEPH_GLOBAL_CONFIG ?= {
cfg = nlist (
'fsid' , CEPH_FSID,
'mon_initial_members', MON_NAMES,
'public_network', CEPH_NETWORK,
'cluster_network', CEPH_CLUSTER_NETWORK,
'osd_pool_default_size', 3,
'osd_pool_default_min_size', 2,
'osd_pool_default_pg_num', 512,
'osd_pool_default_pgp_num', 512,
);
if(length(CEPH_ENABLE_EXP) > 0) {
cfg['enable_experimental_unrecoverable_data_corrupting_features'] = CEPH_ENABLE_EXP;
};
if(to_boolean(CEPH_OSD_DOWN_REPORTERS) && to_boolean(CEPH_OSD_DOWN_REPORTS)) {
cfg['mon_osd_min_down_reporters'] = CEPH_OSD_DOWN_REPORTERS;
cfg['mon_osd_min_down_reports'] = CEPH_OSD_DOWN_REPORTS;
};
if (is_nlist(CEPH_GLOBAL_CONFIG_EXTRA)) {
cfg= merge(cfg, CEPH_GLOBAL_CONFIG_EXTRA);
};
cfg;
};


'config' = CEPH_GLOBAL_CONFIG;

variable CEPH_CRUSHMAP ?= null;
include { CEPH_CRUSHMAP };
9 changes: 9 additions & 0 deletions sites/example/site/ceph/basic/config.pan
@@ -0,0 +1,9 @@
unique template site/ceph/basic/config;

include 'site/ceph/server/config';

variable IS_CEPH_DEPLOYHOST = { DEPLOY_FQDNS[0] == format('%s.%s', value('/system/network/hostname'), value('/system/network/domainname'))};

include { if (IS_CEPH_DEPLOYHOST) { 'components/ceph/config' }};

include { if (IS_CEPH_DEPLOYHOST) { 'site/ceph/basic/cluster' }};
14 changes: 14 additions & 0 deletions sites/example/site/ceph/basic/deploy.pan
@@ -0,0 +1,14 @@
unique template site/ceph/basic/deploy;

variable DEPLOY_NAMES = shorten_fqdns(DEPLOY_FQDNS);

prefix '/software/components/ceph/clusters/ceph';

'deployhosts' = {
ml = nlist();
foreach(idx;host;DEPLOY_NAMES) {
ml[host] = DEPLOY_FQDNS[idx];
};
ml;
};

20 changes: 20 additions & 0 deletions sites/example/site/ceph/basic/mdss.pan
@@ -0,0 +1,20 @@
unique template site/ceph/basic/mdss;

#variable MDS_NAMES = shorten_fqdns(MDS_FQDNS);

prefix '/software/components/ceph/clusters/ceph';


'mdss' = {
ml = nlist();
foreach(idx;host;MDS_FQDNS) {
config = nlist();
if (is_defined(CEPH_MDS_CACHE_SIZE)){
config['mds_cache_size'] = CEPH_MDS_CACHE_SIZE;
};
l = nlist('config', config);
l['fqdn'] = host;
ml[host] = l;
};
ml;
};
18 changes: 18 additions & 0 deletions sites/example/site/ceph/basic/mons.pan
@@ -0,0 +1,18 @@
unique template site/ceph/basic/mons;

variable MON_FQDNS = CEPH_MON_HOSTS;
variable MON_NAMES = shorten_fqdns(MON_FQDNS);

prefix '/software/components/ceph/clusters/ceph';


'monitors' = {
ml = nlist();
foreach(idx;host;MON_NAMES) {
l = nlist();
l['fqdn'] = MON_FQDNS[idx];
ml[host] = l;
};
ml;
};

21 changes: 21 additions & 0 deletions sites/example/site/ceph/basic/osdlist-simple.pan
@@ -0,0 +1,21 @@
unique template site/ceph/basic/osdlist-simple;

# This is very basic and can only be used when using only all equal sized disks
variable CEPH_OSD_IGNORE_LIST ?= CEPH_SSD_DISKS;
variable CEPH_OSD_DISKS = {
hosts = nlist();
foreach(idx;host;CEPH_NODES) {
osds = list();
foreach (disk;data;value(format('%s:/hardware/harddisks', host))) {
# foreach (disk;data;value('/hardware/harddisks')) {
if (index(disk, CEPH_OSD_IGNORE_LIST) == -1) {
append(osds, disk);
};
};
hosts[shorten_fqdn(host)] = osds;
};
hosts;
};
variable TMP_OSDS = CEPH_OSD_DISKS[CEPH_HOSTS[0]];
variable CEPH_DEFAULT_OSD_WEIGHT ?= to_double(value(format('/hardware/harddisks/%s/capacity', TMP_OSDS[0]))) / (1024*1024);

14 changes: 14 additions & 0 deletions sites/example/site/ceph/building/config.pan
@@ -0,0 +1,14 @@
unique template site/ceph/building/config;

include 'site/ceph/server/config';

variable IS_CEPH_DEPLOYHOST = { match(DEPLOY_FQDNS[0], value('/system/network/hostname'))};

include 'components/ceph/config';

variable CEPH_OSD_LIST ?= 'site/ceph/osdlocal/simple';
include {CEPH_OSD_LIST } ;

variable CEPH_OSD_SCHEMA = 'osd-fetch';

include { if (IS_CEPH_DEPLOYHOST) { 'site/ceph/basic/cluster' }};
15 changes: 15 additions & 0 deletions sites/example/site/ceph/client/admin.pan
@@ -0,0 +1,15 @@
unique template site/ceph/client/admin;

include 'site/ceph/client/config';
prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.client.admin.keyring}';

"contents" = if (is_defined(CEPH_ADMIN_SECRET)) {
nlist("client.admin", nlist(
"key", CEPH_ADMIN_SECRET,
)
);
} else {
nlist();
};
'module' = 'tiny';
'mode' = 0600;
22 changes: 22 additions & 0 deletions sites/example/site/ceph/client/cephfs.pan
@@ -0,0 +1,22 @@
unique template site/ceph/client/cephfs;

include 'site/ceph/client/config';

variable CEPH_CEPHFS_USER ?= 'root';
variable CEPH_CEPHFS_GROUP ?= CEPH_CEPHFS_USER;

prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.client.cephfs.keyring}';

"contents" = if (is_defined(CEPH_CEPHFS_SECRET)) {
nlist("client.cephfs", nlist(
"key", CEPH_CEPHFS_SECRET,
)
);
} else {
nlist();
};
'module' = 'tiny';
'mode' = 0600;
'owner' = CEPH_CEPHFS_USER;
'group' = CEPH_CEPHFS_GROUP;

17 changes: 17 additions & 0 deletions sites/example/site/ceph/client/config.pan
@@ -0,0 +1,17 @@
unique template site/ceph/client/config;

include 'site/ceph/common/config';
include 'repository/config/ceph';
include 'site/ceph/client/params';

prefix '/software/packages';
'ceph-fuse' = nlist();

variable CEPH_CLIENT_SET_CONFIG ?= true;

include {
if(CEPH_CLIENT_SET_CONFIG){
'site/ceph/client/configfile';
};
};

11 changes: 11 additions & 0 deletions sites/example/site/ceph/client/configfile.pan
@@ -0,0 +1,11 @@
unique template site/ceph/client/configfile;

prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.conf}/contents';

"global" = nlist(
"mon_host", join(', ', CEPH_MON_HOSTS),
);

prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.conf}';
'module' = 'tiny';

20 changes: 20 additions & 0 deletions sites/example/site/ceph/client/libvirt.pan
@@ -0,0 +1,20 @@
unique template site/ceph/client/libvirt;

include 'site/ceph/client/config';

variable CEPH_LIBVIRT_USER ?= 'oneadmin';
variable CEPH_LIBVIRT_GROUP ?= CEPH_LIBVIRT_USER;
prefix '/software/components/metaconfig/services/{/etc/ceph/ceph.client.libvirt.keyring}';

"contents" = if (is_defined(CEPH_LIBVIRT_SECRET)) {
nlist("client.libvirt", nlist(
"key", CEPH_LIBVIRT_SECRET,
)
);
} else {
nlist();
};
'module' = 'tiny';
'mode' = 0600;
'owner' = CEPH_LIBVIRT_USER;
'group' = CEPH_LIBVIRT_GROUP;
14 changes: 14 additions & 0 deletions sites/example/site/ceph/common/ceph-deploy.pan
@@ -0,0 +1,14 @@
unique template site/ceph/common/ceph-deploy;

variable CEPH_DEPLOY_VERSION ?= {
if (CEPH_MAJOR_VERSION >= 9) {
'1.5.28';
} else {
'1.5.25';
};
};

'/software/packages' = {
pkg_repl("ceph-deploy",format("%s-*",CEPH_DEPLOY_VERSION),'noarch');
};