Skip to content

Commit

Permalink
Merge pull request #1 from ShimonOhayon/add_file_path_override
Browse files Browse the repository at this point in the history
Add file path override
  • Loading branch information
Wiston999 authored Mar 11, 2020
2 parents db3fa38 + 48a5442 commit 5609b0f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
# Parameters: $user is the useraccount on the machine for which the netrc shall be configured,
# $machine_user_password_triples is an array of arrays containing three string params: machine, user, password
# $root_home_directory (optional) is the directory where all user homes are located on the target machine, default value is "/home"
#
# $file_path (optional) is the absolute path of the .netrc file.
# Actions:
#
# Requires:
#
# Sample Usage: netrc::foruser("netrc_myuser": user => 'myuser', machine_user_password_triples => [['myserver.localdomain','myuser','pw'],['mysecondserver.localdomain','myuser','pw2']])
#
# you can also override the full path by using the `file_path` parameter.
# [Remember: No empty lines between comments and class definition]
class netrc {

}

define netrc::foruser(
Enum["present", "absent"] $ensure = "present",
$home_base_directory = "/home",
$user,
$machine_user_password_triples) {

$filename = ".netrc"
Enum["present", "absent"] $ensure = "present",
Stdlib::Absolutepath $home_base_directory = "/home",
String $user,
String $filename = ".netrc",
Stdlib::Absolutepath $file_path = "$home_base_directory/$user/$filename",
Array $machine_user_password_triples) {

file { "$home_base_directory/$user/$filename":
ensure => $ensure,
file { $file_path:
ensure => $ensure,
content => template('netrc/netrc.erb'),
mode => '0600',
owner => "$user"
mode => '0600',
owner => "$user"
}
}

0 comments on commit 5609b0f

Please sign in to comment.