File: etchosts.pp

package info (click to toggle)
openstack-cluster-installer 43.0.18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,484 kB
  • sloc: php: 19,127; sh: 18,142; ruby: 75; makefile: 31; xml: 8
file content (29 lines) | stat: -rw-r--r-- 789 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# == Class: etchosts
#
# Maintains the /etc/hosts so it always contains all the cluster node info
#
# === Parameters:
#
# [*etc_hosts_file*]
#   (optional) A base64 representation of the node's /etc/hosts file
#
class oci::etchosts(
  $etc_hosts_file = undef,
){

  if $etc_hosts_file == undef {
    fail('etc_hosts_file should be a base64 of the /etc/hosts file')
  }

  $decoded_etc_hosts = base64('decode', $etc_hosts_file)
  $etc_hosts_from_fact = $facts['oci_etc_hosts_content']
  $etc_hosts_file_real = "${decoded_etc_hosts}${etc_hosts_from_fact}"

  file { "/etc/hosts":
    ensure                  => file,
    owner                   => "root",
    content                 => $etc_hosts_file_real,
    selinux_ignore_defaults => true,
    mode                    => '0644',
  }
}