From 11ab36bfa062440fb0eeab51a66d68ae6dd0ab72 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Thu, 16 Sep 2021 14:02:29 +0200 Subject: [PATCH] Inline file contents in the catalog The file() function can read a file form a module and return the content. This happens server side and is included in the catalog. This saves a request to the fileserver at runtime. That request can fail for various reasons (it's still a network). It also means that a cached catalog is sufficient and an agent can reapply it without a Puppetserver running. These files are small enough to inline in the catalog. --- manifests/client.pp | 10 +++++----- manifests/repo/yum_postgresql_org.pp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifests/client.pp b/manifests/client.pp index 7bb31a8309..3cb26ce81a 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -26,10 +26,10 @@ } file { $validcon_script_path: - ensure => $file_ensure, - source => 'puppet:///modules/postgresql/validate_postgresql_connection.sh', - owner => 0, - group => 0, - mode => '0755', + ensure => $file_ensure, + content => file('postgresql/validate_postgresql_connection.sh'), + owner => 0, + group => 0, + mode => '0755', } } diff --git a/manifests/repo/yum_postgresql_org.pp b/manifests/repo/yum_postgresql_org.pp index 319751d3b8..be7e26820b 100644 --- a/manifests/repo/yum_postgresql_org.pp +++ b/manifests/repo/yum_postgresql_org.pp @@ -5,11 +5,11 @@ $gpg_key_path = "/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-${package_version}" file { $gpg_key_path: - source => 'puppet:///modules/postgresql/RPM-GPG-KEY-PGDG', - owner => 'root', - group => 'root', - mode => '0644', - before => Yumrepo['yum.postgresql.org'], + content => file('postgresql/RPM-GPG-KEY-PGDG'), + owner => 'root', + group => 'root', + mode => '0644', + before => Yumrepo['yum.postgresql.org'], } if($facts['os']['name'] == 'Fedora') {