1

puppet can do exec on node, but cannot transfer file from module.

Ubuntu 14.04 server Puppet 3.8.4

Already tried:

  • making file world readable
  • disabling FW
  • creating facter.d in module directory

On master:

/etc/puppet/puppet.conf

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
modulepath = /etc/puppet/modules
factpath=$vardir/lib/facter

/etc/puppet/manifests/site.pp

node 'gitlab.domain' {
    include ssh
}

/etc/puppet/modules/ssh/manifests/init.pp

class ssh {
  exec { 'apt-update':
    command => 'apt-get update',
    path    => ['/usr/bin', '/bin', '/sbin'],
    logoutput => on_failure,
  }

  # ensure openssh installed
  package { 'openssh-server':
    ensure  => installed,
    require => Exec['apt-update'],
  }

  # make sure ssh keeps running
  service { 'ssh':
    ensure  => 'running',
    enable  => true,
    require => Package['openssh-server'],
  }


  # copy sshd_config
  file { '/etc/ssh/sshd_config':
    ensure  => 'present',
    notify  => Service['ssh'],
    source  => 'puppet:///modules/ssh/config/sshd_config',
    owner   => 'root',
    group   => 'root',
    mode    => '0600',
    require => Package['openssh-server'],
  }
}

On master:

ls -la /etc/puppet/modules/ssh/config
-rw-r--r-- 1 puppet root 356 Nov 27 11:43 sshd_config

On node:

sudo puppet agent -t -v
[....]
Info: Applying configuration version ...
Notice: /Stage[main]/Ssh/Exec[apt-update]/returns: executed successfully
Error: /Stage[main]/Ssh/File[/etc/ssh/sshd_config]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/ssh/config/sshd_config 
  • Please run sudo puppet agent -t -d and add the output to the question. – 030 Dec 1 '15 at 15:57
  • Please provide the ./etc/puppet/puppet.conf that resides on the master and agent – 030 Dec 1 '15 at 15:58
4

Issue is caused because /etc/puppet/environments/production/modules/ssh/files/config/sshd_config or /etc/puppet/modules/ssh/files/config/sshd_config does not exist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.