-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clone defunct
rayrod2030/filesystem_cookbook
https://github.com/crowdtap/crowdtap/pull/7168 Unfortunately, [`rayrod2030/filesystem_cookbook`][missing] no longer exists. According to Google's cached indexing, `rayrod2030/filesystem_cookbook` was originally forked from [`atrull/filesystem_cookbook`][cookbook]. This commit clones the missing cookbook from a cached check out on a production machine. [missing]: https://github.com/rayrod2030/filesystem_cookbook [cookbook]: https://github.com/atrull/filesystem_cookbook
- Loading branch information
0 parents
commit 31febf9
Showing
16 changed files
with
980 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "http://api.berkshelf.com" | ||
|
||
metadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
DEPENDENCIES | ||
filesystem | ||
path: . | ||
metadata: true | ||
|
||
GRAPH | ||
filesystem (0.9.0) | ||
lvm (~> 1.1.0) | ||
lvm (1.1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Copyright 2013 Alex Trull | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
Description | ||
=========== | ||
|
||
This cookbook exists to generically define and create block device filesystems with the minimum of inputs. | ||
|
||
This cookbook supports four main types of block devices: | ||
|
||
* normal `device` - drives, ssds, volumes presented by HBAs etc | ||
* device ID `uuid` - mostly found on drives / known block IDs. | ||
* LVM Volume Groups `vg` - found on systems using LVM. | ||
* file-backed `file` - created dynamically and looped back - will not come up on reboot, but we will try to remount existing `file` storage in chef. | ||
|
||
We will try to create filesystems in two ways: through keys found in node data under 'filesystems' or by being called directly with the `filesystem` default provider. See the example recipe. | ||
|
||
You can also use your own key for a list of filesystems, see the example recipe for an example of this option. | ||
|
||
Tools have been listed in the following attribute key : filesystem_tools. This allows for extending the support to other/new filesystems. | ||
|
||
Requirements | ||
============ | ||
|
||
* lvm cookbook when creating logical volumes | ||
* package #{fstype}progs to support your chosen fstype. We provide some defaults, too. | ||
|
||
Main Attributes | ||
=============== | ||
|
||
##### `filesystems` | ||
Hash of filesytems to setup - this is called filesystems because filesystem is already created/managed by ohai (i.e. no s on the end). | ||
##### `node[:filesystems]` keys: | ||
Each filesytem's key is the FS `label`: This explains each key in a filesystems entry. The label must not exceed 12 characters. | ||
|
||
We also let you use your own top-level key if you want - see the default recipe and example recipe. | ||
|
||
Filesystem Backing Location keys | ||
================================ | ||
|
||
##### `device` | ||
Path to the device to create the filesystem upon. | ||
##### `uuid` | ||
UUID of the device to create the filesystem upon. | ||
##### `file` | ||
Path to the file-backed storage to be used for a loopback device. `device` must also be present to specify the loopback. If the `file` is not present it will be created, as long as a size is given. | ||
##### `vg` | ||
Name of the LVM volume group use as backing store for a logical volume. If not present it will be created, as long as a size is given. | ||
|
||
Each filesystem should be given one of these attributes for it to have a location to be created at. | ||
|
||
If none of these are present then we try to find a device at the label itself. | ||
|
||
Filesystem Creation Options | ||
=========================== | ||
|
||
##### `fstype` [ocfs2|ext3|ext4|etc] (default: ext3) | ||
The type of filesystem to be created. | ||
##### `mkfs_options` unique for each filesystem. | ||
Options to pass to mkfs at creation time. | ||
|
||
Filesystem Backing Options | ||
========================== | ||
|
||
##### `size` 10000 (`file`) or 10%VG|10g (`vg`) | ||
The size, only used for filesystems backed by `vg` and `file` storage. If vg then a number suffixied by the scale [g|m|t|p], if a file then just a number [megabytes]. | ||
##### `sparse` Boolean (default: true) | ||
Sparse file creation, used by the `file` storage, by default we use this for speed, but you may not want that. | ||
##### `stripes` optional. | ||
The stripes, only used for filesystems backed by `vg` aka LVM storage. | ||
##### `mirrors` optional. | ||
The mirrors, only used for filesystems backed by `vg` aka LVM storage. | ||
|
||
Filesystem Mounting Options | ||
=========================== | ||
|
||
##### `mount` /path/to/mount | ||
Path to mount the filesystem. (If present we will mount the filesystem - this is rather important) | ||
##### `options` rw,noatime,defaults (default: defaults) | ||
Options to mount with and add to the fstab. | ||
##### `dump` 0|1|2 (default: 0) | ||
Dump entry for fstab | ||
##### `pass` 0|1|2 (default: 0) | ||
Pass entry for fstab | ||
##### `user` name | ||
Owner of the mountpoint, otherwise we use the chef default. We will not try to create users. You should use the users cookbook for that. | ||
##### `group` name | ||
Group of the mountpoint, otherwise we use the chef default. We will not try to create groups. You should write a cookbook to make them nicely. | ||
##### `mode` 775 | ||
Mode of the mountpoint, otherwise we use the chef default. | ||
|
||
Package and Recipe Options | ||
========================== | ||
|
||
##### `package` Package name to install, if specified. | ||
Used to support the filesystem | ||
##### `recipe` Recipe to run, if specified - for future use, not currently supported from the lwrp. | ||
Used to support the filesystem | ||
|
||
Atypical Behaviour Modifiers | ||
============================ | ||
|
||
##### `force` Boolean (default: false) | ||
Set to true we unsafely create filesystems even if they already exist. If there is data it will be lost. Should not use this unless you are quite confident. | ||
##### `nomkfs` Boolean (default: false) | ||
Set to true to disable creation of the filesystem. | ||
##### `nomount` Boolean (default: false) | ||
Set to true to disable mounting of the filesystem. | ||
##### `noenable` Boolean (default: false) | ||
Set to true to disable adding to fstab. | ||
|
||
Usage | ||
===== | ||
|
||
Keyed filesystem creation: | ||
|
||
````JSON | ||
{ | ||
"filesystems": { | ||
"testfs1": { | ||
"device": "/dev/sdb", | ||
"mount": "/db", | ||
"fstype": "xfs", | ||
"optons": "noatime,nobarrier", | ||
"mkfs_options": "-d sunit=128,swidth=2048" | ||
}, | ||
"applv1": { | ||
"mount": "/logical1", | ||
"fstype": "ext4", | ||
"vg": "standardvg", | ||
"size": "20G" | ||
}, | ||
"cluster_01": { | ||
"fstype": "ocfs2", | ||
"package": "ocfs2-tools", | ||
"device": "/dev/mpath/ocfs01", | ||
"mount": "/mnt/test" | ||
}, | ||
"filebacked": { | ||
"file": "/mnt/filesystem-on-a-filesystem.file", | ||
"device": "/dev/loop7", | ||
"mount": "/mnt/filesystem-on-a-filesystem", | ||
"size": "20000" | ||
} | ||
} | ||
} | ||
```` | ||
|
||
Direct LWRP'd creation: | ||
|
||
````RUBY | ||
filesystem "label" do | ||
fstype "ext3" | ||
device "/dev/sdb1" | ||
mount "/mnt/littlelabel" | ||
action [:create, :enable, :mount] | ||
end | ||
```` | ||
|
||
Links | ||
===== | ||
|
||
Development is at https://github.com/atrullmdsol/filesystem_cookbook | ||
Opscode community page is at http://community.opscode.com/cookbooks/filesystem | ||
|
||
Authors | ||
======= | ||
|
||
* Alex Trull <cookbooks.atrullmdsol@trull.org> | ||
* Jesse Nelson <spheromak@gmail.com> source of the original cookbook. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# | ||
# Cookbook Name:: filesystem | ||
# Attributes:: default | ||
# | ||
# Copyright 2013 Alex Trull | ||
# | ||
# 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. | ||
# | ||
|
||
# This is used to create the filesystems themselves, see examples in the README. | ||
default[:filesystems] = Hash.new | ||
|
||
# These are used to provide sensible default recipes and packages for installing tools for supporting filesystems. | ||
# The format is [:filesystem_tools][:fstype][:package|recipe] = "package1,package2" | ||
default[:filesystem_tools][:ext2][:package] = "e2fsprogs" | ||
default[:filesystem_tools][:ext3][:package] = "e2fsprogs" | ||
default[:filesystem_tools][:ext4][:package] = "e2fsprogs" | ||
default[:filesystem_tools][:xfs][:package] = "xfsprogs" | ||
default[:filesystem_tools][:btrfs][:package] = "btrfs-tools" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require 'pathname' | ||
require 'chef/mixin/shell_out' | ||
|
||
module FilesystemMod | ||
include Chef::Mixin::ShellOut | ||
|
||
MOUNT_EX_FAIL = 32 unless const_defined?(:MOUNT_EX_FAIL) | ||
|
||
# Check to determine if the device is mounted. | ||
def is_mounted?(device) | ||
system("grep -q '#{device}' /proc/mounts") | ||
end | ||
|
||
# Check to determine if the mount is frozen. | ||
def is_frozen?(mount) | ||
fields = File.readlines('/proc/mounts').map {|line| line.split}.detect {|fields| fields[1] == mount} | ||
raise "#{mount} not mounted" unless fields | ||
remount = shell_out('mount', '-o', "remount,#{fields[3]}", mount) | ||
if remount.exitstatus == MOUNT_EX_FAIL | ||
true | ||
else | ||
remount.error! | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
if defined?(ChefSpec) | ||
def create_filesystem(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new('filesystem', :create, resource_name) | ||
end | ||
|
||
def enable_filesystem(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new('filesystem', :enable, resource_name) | ||
end | ||
|
||
def mount_filesystem(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new('filesystem', :mount, resource_name) | ||
end | ||
|
||
def freeze_filesystem(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new('filesystem', :freeze, resource_name) | ||
end | ||
|
||
def unfreeze_filesystem(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new('filesystem', :unfreeze, resource_name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "filesystem", | ||
"description": "Installs/Configures various filesystems", | ||
"long_description": "Description\n===========\n\nThis cookbook exists to generically define and create block device filesystems with the minimum of inputs.\n\nThis cookbook supports four main types of block devices:\n\n* normal `device` - drives, ssds, volumes presented by HBAs etc\n* device ID `uuid` - mostly found on drives / known block IDs.\n* LVM Volume Groups `vg` - found on systems using LVM.\n* file-backed `file` - created dynamically and looped back - will not come up on reboot, but we will try to remount existing `file` storage in chef.\n\nWe will try to create filesystems in two ways: through keys found in node data under 'filesystems' or by being called directly with the `filesystem` default provider. See the example recipe.\n\nYou can also use your own key for a list of filesystems, see the example recipe for an example of this option.\n\nTools have been listed in the following attribute key : filesystem_tools. This allows for extending the support to other/new filesystems.\n\nRequirements\n============\n\n* lvm cookbook when creating logical volumes\n* package #{fstype}progs to support your chosen fstype. We provide some defaults, too.\n\nMain Attributes\n===============\n\n##### `filesystems` \nHash of filesytems to setup - this is called filesystems because filesystem is already created/managed by ohai (i.e. no s on the end).\n##### `node[:filesystems]` keys:\nEach filesytem's key is the FS `label`: This explains each key in a filesystems entry. The label must not exceed 12 characters.\n\nWe also let you use your own top-level key if you want - see the default recipe and example recipe.\n\nFilesystem Backing Location keys\n================================\n\n##### `device`\nPath to the device to create the filesystem upon.\n##### `uuid`\nUUID of the device to create the filesystem upon.\n##### `file`\nPath to the file-backed storage to be used for a loopback device. `device` must also be present to specify the loopback. If the `file` is not present it will be created, as long as a size is given.\n##### `vg`\nName of the LVM volume group use as backing store for a logical volume. If not present it will be created, as long as a size is given.\n\nEach filesystem should be given one of these attributes for it to have a location to be created at. \n\nIf none of these are present then we try to find a device at the label itself.\n\nFilesystem Creation Options\n===========================\n\n##### `fstype` [ocfs2|ext3|ext4|etc] (default: ext3)\nThe type of filesystem to be created.\n##### `mkfs_options` unique for each filesystem.\nOptions to pass to mkfs at creation time.\n\nFilesystem Backing Options\n==========================\n\n##### `size` 10000 (`file`) or 10%VG|10g (`vg`)\nThe size, only used for filesystems backed by `vg` and `file` storage. If vg then a number suffixied by the scale [g|m|t|p], if a file then just a number [megabytes].\n##### `sparse` Boolean (default: true)\nSparse file creation, used by the `file` storage, by default we use this for speed, but you may not want that.\n##### `stripes` optional.\nThe stripes, only used for filesystems backed by `vg` aka LVM storage.\n##### `mirrors` optional.\nThe mirrors, only used for filesystems backed by `vg` aka LVM storage. \n\nFilesystem Mounting Options\n===========================\n\n##### `mount` /path/to/mount\nPath to mount the filesystem. (If present we will mount the filesystem - this is rather important)\n##### `options` rw,noatime,defaults (default: defaults)\nOptions to mount with and add to the fstab.\n##### `dump` 0|1|2 (default: 0)\nDump entry for fstab\n##### `pass` 0|1|2 (default: 0)\nPass entry for fstab\n##### `user` name\nOwner of the mountpoint, otherwise we use the chef default. We will not try to create users. You should use the users cookbook for that.\n##### `group` name\nGroup of the mountpoint, otherwise we use the chef default. We will not try to create groups. You should write a cookbook to make them nicely.\n##### `mode` 775\nMode of the mountpoint, otherwise we use the chef default.\n\nPackage and Recipe Options\n==========================\n\n##### `package` Package name to install, if specified.\nUsed to support the filesystem\n##### `recipe` Recipe to run, if specified - for future use, not currently supported from the lwrp.\nUsed to support the filesystem\n\nAtypical Behaviour Modifiers\n============================\n\n##### `force` Boolean (default: false)\nSet to true we unsafely create filesystems even if they already exist. If there is data it will be lost. Should not use this unless you are quite confident.\n##### `nomkfs` Boolean (default: false)\nSet to true to disable creation of the filesystem.\n##### `nomount` Boolean (default: false)\nSet to true to disable mounting of the filesystem.\n##### `noenable` Boolean (default: false)\nSet to true to disable adding to fstab.\n\nUsage\n=====\n\nKeyed filesystem creation:\n\n````JSON\n{\n \"filesystems\": { \n \"testfs1\": {\n \"device\": \"/dev/sdb\",\n \"mount\": \"/db\",\n \"fstype\": \"xfs\",\n \"optons\": \"noatime,nobarrier\",\n \"mkfs_options\": \"-d sunit=128,swidth=2048\"\n },\n \"applv1\": {\n \"mount\": \"/logical1\",\n \"fstype\": \"ext4\",\n \"vg\": \"standardvg\",\n \"size\": \"20G\"\n },\n \"cluster_01\": {\n \"fstype\": \"ocfs2\",\n \"package\": \"ocfs2-tools\",\n \"device\": \"/dev/mpath/ocfs01\",\n \"mount\": \"/mnt/test\"\n },\n \"filebacked\": {\n \"file\": \"/mnt/filesystem-on-a-filesystem.file\",\n \"device\": \"/dev/loop7\",\n \"mount\": \"/mnt/filesystem-on-a-filesystem\",\n \"size\": \"20000\"\n }\n }\n}\n````\n\nDirect LWRP'd creation:\n\n````RUBY\nfilesystem \"label\" do\n fstype \"ext3\"\n device \"/dev/sdb1\"\n mount \"/mnt/littlelabel\"\n action [:create, :enable, :mount]\nend\n````\n\nLinks\n=====\n\nDevelopment is at https://github.com/atrullmdsol/filesystem_cookbook\nOpscode community page is at http://community.opscode.com/cookbooks/filesystem\n\nAuthors\n=======\n\n* Alex Trull <cookbooks.atrullmdsol@trull.org>\n* Jesse Nelson <spheromak@gmail.com> source of the original cookbook.\n", | ||
"maintainer": "Alex Trull", | ||
"maintainer_email": "cookbooks.atrullmdsol@trull.org", | ||
"license": "Apache 2.0", | ||
"platforms": { | ||
"redhat": ">= 0.0.0", | ||
"centos": ">= 0.0.0", | ||
"xenserver": ">= 0.0.0", | ||
"ubuntu": ">= 0.0.0", | ||
"debian": ">= 0.0.0", | ||
"scientific": ">= 0.0.0", | ||
"amazon": ">= 0.0.0" | ||
}, | ||
"dependencies": { | ||
"lvm": "~> 1.1.0" | ||
}, | ||
"recommendations": { | ||
}, | ||
"suggestions": { | ||
}, | ||
"conflicting": { | ||
}, | ||
"providing": { | ||
}, | ||
"replacing": { | ||
}, | ||
"attributes": { | ||
"filesystems": { | ||
"description": "Filesystems to be created and/or mounted", | ||
"type": "hash", | ||
"required": "recommended", | ||
"choice": [ | ||
|
||
], | ||
"calculated": false, | ||
"recipes": [ | ||
|
||
] | ||
} | ||
}, | ||
"groupings": { | ||
}, | ||
"recipes": { | ||
}, | ||
"version": "0.9.1", | ||
"source_url": "", | ||
"issues_url": "" | ||
} |
Oops, something went wrong.