Satellite remote execution - deploy key with Puppet

Latest response

Provisioning new hosts, you can modify provisioning template to deploy key for remote execution during build.

What if you want to deploy key on existing managed hosts?
Here is a manifest to deploy keys on existing managed hosts with Puppet 3.8 agents.

class rhel6module::rex {

  user { 'root':
    ensure => 'present',
    system => 'true',
  }

  file { '/root/.ssh/':
    ensure => directory,
    mode   => '0700',
    owner  => 'root',
    group  => 'root',
    require => User['root']
  }

  ssh_authorized_key { 'foreman-proxy@satellite.local.net':
    user    => 'root',
    type    => 'ssh-rsa',
    key     => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    require => File['/root/.ssh']
  }
}

Responses

That's one way. You can also use the hash_resources module, as noted in Making systems ready for Satellite 6.2's remote execution