comparison modules/ssh/manifests/config_entry.pp @ 385:d9009f54eb23

Migrate to a fully-fledged SSH module This handles lots of the server path differences for us
author IBBoard <dev@ibboard.co.uk>
date Mon, 03 Jan 2022 17:05:54 +0000
parents
children adf6fe9bbc17
comparison
equal deleted inserted replaced
384:22e45bb5ea97 385:d9009f54eb23
1 # == Define: ssh::config_entry
2 #
3 # Manage an entry in ~/.ssh/config for a particular user. Lines model the lines
4 # in each Host block.
5 define ssh::config_entry (
6 $owner,
7 $group,
8 $path,
9 $host,
10 $order = '10',
11 $ensure = 'present',
12 $lines = [],
13 ) {
14
15 # All lines including the host line. This will be joined with "\n " for
16 # indentation.
17 $entry = concat(["Host ${host}"], $lines)
18 $content = join($entry, "\n")
19
20 if ! defined(Concat[$path]) {
21 concat { $path:
22 ensure => present,
23 owner => $owner,
24 group => $group,
25 mode => '0644',
26 ensure_newline => true,
27 }
28 }
29
30 concat::fragment { "${path} Host ${host}":
31 target => $path,
32 content => $content,
33 order => $order,
34 tag => "${owner}_ssh_config",
35 }
36 }