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

Add password option #138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions manifests/get.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# $chmod - permissions to pass to rsync (optional)
# $logfile - logname to pass to rsync (optional)
# $onlyif - Condition to run the rsync command
# $password - password to be passed via the RSYNC_PASSWORD environment variable
#
# Actions:
# get files via rsync
Expand Down Expand Up @@ -52,6 +53,7 @@
$chmod = undef,
$logfile = undef,
$onlyif = undef,
$password = undef,
) {

if $keyfile {
Expand Down Expand Up @@ -152,11 +154,17 @@
$onlyif_real = $onlyif
}

if $password {
$env = [ "RSYNC_PASSWORD=${password}" ]
} else {
$env = undef
}

exec { "rsync ${name}":
command => "rsync -q ${rsync_options}",
path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
user => $execuser,
command => "rsync -q ${rsync_options}",
path => [ '/bin', '/usr/bin', '/usr/local/bin' ],
user => $execuser,
environment => $env,
# perform a dry-run to determine if anything needs to be updated
# this ensures that we only actually create a Puppet event if something needs to
# be updated
Expand Down