Problem:
Hey guys, Iam trying to get the following ansible-role from elnappo to work with foreman.
Unfortunately one of the tasks always throws a “permission denied” error when I execute the following Playbook via job template.
When I execute the playbook via commandline (ansible-playbook playbookname.yml) everything works as expected.
Anyone got an idea why its not working via foreman?
Link to ansible role: https://github.com/elnappo/ansible-role-check-mk-agent
Error message in foreman UI:
TASK [elnappo.check_mk_agent : Scan SSH host pubkey] ***************************
55:
fatal: [HOSTNAME_HERE]: UNREACHABLE! => {“changed”: false, “msg”: “Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).”, “unreachable”: true}
Playbook:
-
hosts: all
gather_facts: true
vars:
check_mk_agent_over_ssh: True
check_mk_agent_with_sudo: True
check_mk_agent_add_host_pubkey: True
check_mk_agent_monitoring_host: HOST_HERE
check_mk_agent_monitoring_user: USER_HERE
check_mk_agent_pubkey_file: URL_HERE
check_mk_agent_add_to_wato: True
check_mk_agent_monitoring_host_discovery_mode: new
check_mk_agent_monitoring_host_url: URL_HERE
check_mk_agent_monitoring_host_wato_username: automation
check_mk_agent_monitoring_host_wato_secret: PASSWORT_HERE
check_mk_agent_monitoring_host_folder: FOLDER_HERE
check_mk_agent_setup_firewall: False
check_mk_agent_manual_install: False
check_mk_agent_local_checks:
count_users:
src: files/localchecks/count_users
cache_time: 600
count_zombie_procs:
src: files/localchecks/count_zombie_procs
cache_time: 600
check_mk_agent_plugins:
lvm:
src: files/plugins/lvm
mk_inventory.linux:
src: files/plugins/mk_inventory.linux
mk_sshd_config:
src: files/plugins/mk_sshd_config
netstat.linux:
src: files/plugins/netstat.linux
mk_logwatch:
src: files/plugins/mk_logwatchroles:
- role: elnappo.check_mk_agent
Expected outcome:
Foreman and Proxy versions:
foreman-1.18.0.40-1.el7sat.noarch
Foreman and Proxy plugin versions:
ansible-2.6.13-1.el7ae.noarch
tfm-rubygem-foreman_ansible-2.2.9-8.el7sat.noarch
ansiblerole-insights-client-1.5-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_ansible-0.1.1-1.el7sat.noarch
tfm-rubygem-foreman_ansible_core-2.1.1-1.el7sat.noarch