2018-02-27 18:58:42 +00:00
|
|
|
# Common configuration for acme_vault
|
|
|
|
#
|
|
|
|
|
2018-02-22 20:50:27 +00:00
|
|
|
class acme_vault::common (
|
|
|
|
$user = $::acme_vault::params::user,
|
|
|
|
$group = $::acme_vault::params::group,
|
|
|
|
$home_dir = $::acme_vault::params::home_dir,
|
2018-02-26 18:01:25 +00:00
|
|
|
$contact_email = $::acme_vault::params::contact_email,
|
2018-03-01 20:59:07 +00:00
|
|
|
$domains = $::acme_vault::params::domains,
|
2018-02-22 20:50:27 +00:00
|
|
|
|
|
|
|
$vault_token = $::acme_vault::params::vault_token,
|
|
|
|
$vault_addr = $::acme_vault::params::vault_addr,
|
|
|
|
$vault_bin = $::acme_vault::params::vault_bin,
|
2018-02-23 15:03:41 +00:00
|
|
|
$vault_prefix = $::acme_vault::params::vault_prefix,
|
2018-02-22 20:50:27 +00:00
|
|
|
|
|
|
|
) inherits acme_vault::params {
|
|
|
|
|
|
|
|
$common_bashrc_template = @(END)
|
2018-02-27 18:58:42 +00:00
|
|
|
export PATH=$HOME:$PATH
|
2018-02-22 20:50:27 +00:00
|
|
|
export VAULT_BIN=<%= @vault_bin %>
|
|
|
|
export VAULT_TOKEN=<%= @vault_token %>
|
|
|
|
export VAULT_ADDR=<%= @vault_addr %>
|
2018-02-23 15:03:41 +00:00
|
|
|
export VAULT_PREFIX=<%= @vault_prefix %>
|
2018-02-22 20:50:27 +00:00
|
|
|
END
|
|
|
|
# create acme_vault user
|
|
|
|
user { $user:
|
|
|
|
ensure => present,
|
|
|
|
gid => $group,
|
|
|
|
system => true,
|
|
|
|
home => $home_dir,
|
|
|
|
managehome => true,
|
|
|
|
}
|
|
|
|
|
|
|
|
file { $home_dir:
|
|
|
|
ensure => directory,
|
|
|
|
owner => $user,
|
|
|
|
group => $group,
|
2018-02-26 19:54:07 +00:00
|
|
|
mode => '0750',
|
2018-02-22 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# vault module isn't too flexible for install only, just copy in binary
|
|
|
|
# would be nice if this worked!
|
|
|
|
#class { '::vault::install':
|
|
|
|
# manage_user => false,
|
|
|
|
#}
|
2018-02-26 19:54:07 +00:00
|
|
|
|
2018-02-22 20:50:27 +00:00
|
|
|
file { $vault_bin:
|
|
|
|
ensure => present,
|
2018-02-26 19:54:07 +00:00
|
|
|
owner => 'root',
|
|
|
|
group => 'root',
|
|
|
|
mode => '0555',
|
|
|
|
source => 'puppet:///modules/acme_vault/vault',
|
2018-02-22 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# variables in bashrc
|
|
|
|
concat { "${home_dir}/.bashrc":
|
2018-02-26 19:54:07 +00:00
|
|
|
owner => $user,
|
|
|
|
group => $group,
|
|
|
|
mode => '0600',
|
2018-02-22 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2018-02-26 19:54:07 +00:00
|
|
|
concat::fragment{ 'vault_bashrc':
|
2018-02-22 20:50:27 +00:00
|
|
|
target => "${home_dir}/.bashrc",
|
|
|
|
content => inline_template($common_bashrc_template),
|
2018-02-26 19:54:07 +00:00
|
|
|
order => '01',
|
2018-02-22 20:50:27 +00:00
|
|
|
}
|
|
|
|
|
2018-02-26 18:01:25 +00:00
|
|
|
# common dummy cron job to set MAILTO
|
2018-02-26 19:54:07 +00:00
|
|
|
cron { 'dummy_mailto':
|
|
|
|
command => '/bin/true',
|
2018-02-26 18:01:25 +00:00
|
|
|
user => $user,
|
|
|
|
month => 7,
|
|
|
|
environment => "MAILTO=${contact_email}",
|
|
|
|
}
|
|
|
|
|
2018-02-22 20:50:27 +00:00
|
|
|
}
|
|
|
|
|