jaya
jaya

Reputation: 1

Populate non ascii password in a file using puppet

I am trying to populate a password with non ascii characters into a template file using puppet. I have ecoded password with non ascii to base64 and placed it in hiera-esecrets. When I try to decode the password in template it was not working.

puppet

    class abc::container ( 
     $key_encrypt       = hiera('abc::configs::key_encrypt', undef), ){
    @docker_container { "${app}:${version}":     

   files                 => {       
   'configuration.properties'    => {         
   destination                   => '/opt/configuration.properties',         
    mount_mode                   => 'rw',         
    owner                        => 'root',         
    group                        => 'root',         
    mode                         => '0755',         
    content                      => template('abc/configuration.properties.erb'),       },     }, }

configuration.properties.erb

<% 
require 'base64' 
key_encrypt = @key_encrypt key_encrypt_d = Base64.decode64(key_encrypt) 
%> 
master.key.2024-08-22-02-05=<%= @key_encrypt_d %>

Below is the error when puppet gets executed

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse inline template: invalid byte sequence in US-ASCII

All I see is the base64 encoded value in the template file. I want to get the actual password.

Upvotes: 0

Views: 77

Answers (0)

Related Questions