Puppet Class: ipa::client::host::deploy

Defined in:
manifests/client/host/deploy.pp

Overview

NOTE: use this to deploy the exported resource @@ipa::client::host on clients define ipa::client::host::deploy(

Parameters:

  • hostname (Any) (defaults to: $::hostname)
  • domain (Any) (defaults to: $::domain)
  • server (Any) (defaults to: '')
  • nametag (Any) (defaults to: '')
  • debug (Any) (defaults to: false)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'manifests/client/host/deploy.pp', line 20

class ipa::client::host::deploy(
	$hostname = $::hostname,
	$domain = $::domain,
	$server = '',
	$nametag = '',				# pick a tag to collect...
	$debug = false
) {
	$valid_domain = downcase($domain)	# TODO: validate ?

	# if $hostname has dots, then assume it's a fqdn, if not, we add $domain
	$valid_fqdn = delete("${hostname}", '.') ? {
		"${hostname}" => "${hostname}.${valid_domain}",	# had no dots present
		default => "${hostname}",			# had dots present...
	}

	# NOTE: the resource collects by fqdn; one good reason to use the fqdn!
	# sure you can override this by choosing your own $name value, but why?
	$valid_tag = "${nametag}" ? {
		'' => "${valid_fqdn}",
		default => "${nametag}",
	}

	# TODO: if i had more than one arg to decide to override, then i would
	# have to build a big tree of nested choices... this is one more place
	# where puppet shows it's really not a mature language yet. oh well...
	if "${server}" == '' {
		Ipa::Client::Host <<| tag == "${valid_tag}" |>> {
			debug => $debug,
		}
	} else {
		Ipa::Client::Host <<| tag == "${valid_tag}" |>> {
			server => "${server}",	# override...
			debug => $debug,
		}
	}
}