Remote SSH execution on CentOS8

Problem:

Keys are distributed OK and SSH session is opened, however receive error in /var/log/secure:

“pam_systemd(sudo:session): Cannot create session: Already running in a session or user slice”

when testing pre-bundled Job “Run Puppet Once”

Expected outcome:

Puppet runs once.

Foreman and Proxy versions:

foreman: 2.2.1
foremanproxy: 2.2.1

Foreman and Proxy plugin versions:

foreman_remote_execution: 4.1.0

Distribution and version:

CentOS 8.2004

Other relevant data:

Had to do two things:

    • Allow the remote execution user to sudo as root:
      /opt/puppetlabs/bin/puppet, /var/tmp/*/script
    • Generate an SSH key for user foreman-proxy and distribute it to the remote execution user’s authorized_keys

Both actions can be performed using puppet manifests.