- From: Gregory Symons <
>
- To: "<
>" <
>
- Subject: [chef] Re: Re: Re: How to format a volume and mount after using aws_ebs_volume
- Date: Mon, 24 Jun 2013 13:32:20 +0000
- Accept-language: en-US
Well, the second execute could be a directory resource. For detecting if the volume is formatted, you can use blkid. That's what the lvm_logical_volume provider in the lvm cookbook does. Or, if you're willing to use LVM, just use the lvm cookbook to do
it:
lvm_volume_group 'vg-data' do
physical_volumes '/dev/sdi'
logical_volume 'data' do
size '100%VG'
filesystem 'ext3'
mount_point '/data'
end
end
Greg Symons
Sent from my IPad
On Jun 22, 2013, at 11:10 PM, "David Montgomery" <
">
> wrote:
Hi is what I used...seemed to work but I am not too happy about the execute blocks. Any way to make more pretty?
include_recipe "aws"
data_bag("my_data_bag")
db = data_bag_item("my_data_bag", "my")
aws = db['development']['aws']
aws_ebs_volume "db_ebs_volume" do
aws_access_key aws['aws_access_key_id']
aws_secret_access_key aws['aws_secret_access_key']
size 50
device "/dev/sdi"
action [ :create, :attach ]
end
execute "format_vol" do
command "sudo mkfs.ext3 /dev/xvdi"
action :run
not_if {File.exists?("/data")}
end
execute "mkdir_data" do
command "sudo mkdir /data"
action :run
not_if {File.exists?("/data")}
end
mount "/data" do
device "/dev/xvdi"
fstype "ext3"
action [:mount, :enable]
end
|
Archive powered by MHonArc 2.6.16.