From 4d6c5941299ad18159063e1ba00aa2d93279f7fa Mon Sep 17 00:00:00 2001 From: fschaer Date: Fri, 25 Sep 2020 11:09:05 +0200 Subject: [PATCH] Install into subdirs, and allow for upgrade by changing the version param. Make sure the users/groups that are created are system ones. Fix hardcoded /opt path --- manifests/install.pp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 139eb0e..13617af 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -8,17 +8,31 @@ ){ $download_url = "${coredns::download_url_base}v${coredns::version}/coredns_${coredns::version}_linux_${coredns::real_arch}.tgz" + file { "${coredns::install_dir}/coredns-${coredns::version}" : + ensure => 'directory', + mode => '0755', + } + -> archive { "/tmp/coredns-${coredns::version}.tgz": ensure => present, extract => true, - extract_path => $coredns::install_dir, + extract_path => "${coredns::install_dir}/coredns-${coredns::version}", source => $download_url, checksum_verify => false, - creates => '/opt/coredns', + creates => "${coredns::install_dir}/coredns-${coredns::version}/coredns", cleanup => true, } + -> + #symlink for the service + file { "${coredns::install_dir}/coredns": + force => true, + target => "${coredns::install_dir}/coredns-${coredns::version}/coredns", + notify => Service['coredns'], + } + group { $coredns::user: ensure => present, + system => true, } -> user { $coredns::user: ensure => present, @@ -27,5 +41,6 @@ password => '*', managehome => false, home => '/nonexistent', + system => true, } }