forked from mrafols/capriza-s3cmd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fa393e6
Showing
9 changed files
with
187 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,13 @@ | ||
Copyright (C) 2013 Alon Becker <[email protected]> | ||
|
||
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,8 @@ | ||
name 'capriza-s3cmd' | ||
version '0.1.1' | ||
source 'git://github.com/capriza/capriza-s3cmd.git' | ||
author 'Alon Becker' | ||
license 'Apache 2.0' | ||
summary 'S3cmd Module' | ||
description 'S3cmd Module for file downloads of s3 objects using s3cmd get' | ||
project_page 'https://github.com/capriza/capriza-s3cmd' |
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,55 @@ | ||
# S3cmd module for Puppet | ||
|
||
This module manages s3cmd on Linux (RedHat/Debian) distros. | ||
|
||
## Description | ||
|
||
This module uses the fact osfamily which is supported by Facter 1.6.1+. If you do not have facter 1.6.1 in your environment, the following manifests will provide the same functionality in site.pp (before declaring any node): | ||
|
||
if ! $::osfamily { | ||
case $::operatingsystem { | ||
'RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL': { | ||
$osfamily = 'RedHat' | ||
} | ||
'ubuntu', 'debian': { | ||
$osfamily = 'Debian' | ||
} | ||
'SLES', 'SLED', 'OpenSuSE', 'SuSE': { | ||
$osfamily = 'Suse' | ||
} | ||
'Solaris', 'Nexenta': { | ||
$osfamily = 'Solaris' | ||
} | ||
default: { | ||
$osfamily = $::operatingsystem | ||
} | ||
} | ||
} | ||
|
||
## Usage | ||
|
||
### s3cmd | ||
Installs and configures s3cmd command line tool (http://s3tools.org/s3cmd). | ||
|
||
class {'s3cmd': | ||
aws_access_key => '*********************************', | ||
aws_secret_key => '*********************************', | ||
gpg_passphrase => 'gpg password for encryption', | ||
owner => 'owner', | ||
} | ||
|
||
* Retrieve aws access and secret key from your aws account | ||
* gpg_passphrase is a password used from encrypting and decrypting data. The passphrase is yours to choose. | ||
* owner is the user that will run the s3cmd command. The s3cmd configuration file will be stored in users home directory | ||
|
||
### s3cmd::commands::get | ||
Downloads an object from s3. | ||
|
||
s3cmd::commands::get{'local file': | ||
s3_object => 'https://s3.amazonaws.com/(bucket name)/(object name)', | ||
owner => 'owner', | ||
} | ||
|
||
* The name of the s3::commands::get is the local file name of the object you are retrieving | ||
* s3_object is the https path to the s3 object | ||
* owner is the owner of the s3cmd command. It is the same owner as declared in the s3cmd class. |
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,11 @@ | ||
# | ||
# Save this file to /etc/yum.repos.d on your system | ||
# and run "yum install s3cmd" | ||
# | ||
[s3tools] | ||
name=Tools for managing Amazon S3 - Simple Storage Service (RHEL_6) | ||
type=rpm-md | ||
baseurl=http://s3tools.org/repo/RHEL_6/ | ||
gpgcheck=1 | ||
gpgkey=http://s3tools.org/repo/RHEL_6/repodata/repomd.xml.key | ||
enabled=1 |
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,12 @@ | ||
define s3cmd::commands::get( | ||
$s3_object, | ||
$owner, | ||
) { | ||
exec{$name: | ||
command => "s3cmd ${s3_object} ${name}", | ||
path=>'/usr/bin', | ||
user => $owner, | ||
creates => $name, | ||
require => Class['s3cmd::config','s3cmd::install'], | ||
} | ||
} |
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,17 @@ | ||
class s3cmd::config( | ||
$aws_access_key, | ||
$aws_secret_key, | ||
$gpg_passphrase, | ||
$owner, | ||
) { | ||
$homedir = $owner ? { | ||
root => '/root', | ||
default => "/home/$owner", | ||
} | ||
|
||
file{"$homedir/.s3cfg": | ||
owner => $owner, | ||
content => template("s3cmd/s3cfg.erb"), | ||
} | ||
|
||
} |
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,16 @@ | ||
class s3cmd ( | ||
$aws_access_key, | ||
$aws_secret_key, | ||
$gpg_passphrase, | ||
$owner, | ||
) | ||
{ | ||
class{'s3cmd::install':} | ||
class{'s3cmd::config': | ||
aws_access_key => $aws_access_key, | ||
aws_secret_key => $aws_secret_key, | ||
gpg_passphrase => $gpg_passphrase, | ||
owner => $owner, | ||
require => Class['s3cmd::install'], | ||
} | ||
} |
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,17 @@ | ||
class s3cmd::install (){ | ||
|
||
if $osfamily == 'redhat' { | ||
file {'/etc/yum.repos.d/s3tools.repo': | ||
source => 'puppet:///modules/s3cmd/etc/yum.repos.d/s3tools.repo', | ||
} | ||
$s3cmd_require = File['/etc/yum.repos.d/s3tools.repo'] | ||
} else { | ||
$s3cmd_require = undef | ||
} | ||
|
||
package {'s3cmd': | ||
ensure => installed, | ||
require => $s3cmd_require, | ||
} | ||
|
||
} |
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,38 @@ | ||
[default] | ||
access_key = <%= @aws_access_key %> | ||
bucket_location = US | ||
cloudfront_host = cloudfront.amazonaws.com | ||
cloudfront_resource = /2010-07-15/distribution | ||
default_mime_type = binary/octet-stream | ||
delete_removed = False | ||
dry_run = False | ||
encoding = UTF-8 | ||
encrypt = False | ||
follow_symlinks = False | ||
force = False | ||
get_continue = False | ||
gpg_command = /usr/bin/gpg | ||
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s | ||
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s | ||
gpg_passphrase = <%= @gpg_passphrase %> | ||
guess_mime_type = True | ||
host_base = s3.amazonaws.com | ||
host_bucket = %(bucket)s.s3.amazonaws.com | ||
human_readable_sizes = False | ||
list_md5 = False | ||
log_target_prefix = | ||
preserve_attrs = True | ||
progress_meter = True | ||
proxy_host = | ||
proxy_port = 0 | ||
recursive = False | ||
recv_chunk = 4096 | ||
reduced_redundancy = False | ||
secret_key = <%= @aws_secret_key %> | ||
send_chunk = 4096 | ||
simpledb_host = sdb.amazonaws.com | ||
skip_existing = False | ||
socket_timeout = 10 | ||
urlencoding_mode = normal | ||
use_https = True | ||
verbosity = WARNING |