Hi @robin.gierse ,
Thanks a lot for your support.
In the site’s web.log
, I did not see any relevant requests for both Checkmk systems regarding ansible automate.
I tried running hostgroup creation ansible with -vvv and saw a difference when Checkmk clustered reported Failed to connect to the host via ssh: Shared connection to IP closed. ESTABLISH SSH CONNECTION FOR USER: root
while standalone one only reported Shared connection to IP closed. ESTABLISH SSH CONNECTION FOR USER: root
I spent much time on this and should no ssh issues. Both Checkmk systems are now on the same network. All ssh config/version are same, and logs are also same.
Here is the output for Checkmk clustered:
ansible-playbook [core 2.14.6]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/cmk/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/cmk/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] (/usr/bin/python3)
jinja version = 3.0.3
libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /mnt/c/cmk/inventory/kemp-cmk as it did not pass its verify_file() method
auto declined parsing /mnt/c/cmk/inventory/kemp-cmk as it did not pass its verify_file() method
Parsed /mnt/c/cmk/inventory/kemp-cmk inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: hostgroup.yml ******************************************************************************************************************************************************************************************
1 plays in hostgroup.yml
PLAY [Create Host Groups] *************************************************************************************************************************************************************************************
TASK [Create a single host group] *****************************************************************************************************************************************************************************
task path: /mnt/c/cmk/hostgroup.yml:7
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<10.165.31.147> (0, b'/root\n', b'')
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403 `" && echo ansible-tmp-1689852493.270862-67-217590670387403="` echo /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403 `" ) && sleep 0'"'"''
<10.165.31.147> (0, b'ansible-tmp-1689852493.270862-67-217590670387403=/root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403\n', b'')
<kempCMK> Attempting python interpreter discovery
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.11'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.10'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<10.165.31.147> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3.7\n/usr/bin/python3\n/usr/bin/python2.7\n/usr/bin/python\n/usr/bin/python\nENDFOUND\n', b'')
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'/usr/bin/python3.7 && sleep 0'"'"''
<10.165.31.147> (0, b'{"platform_dist_result": ["debian", "10.13", ""], "osrelease_content": "PRETTY_NAME=\\"Debian GNU/Linux 10 (buster)\\"\\nNAME=\\"Debian GNU/Linux\\"\\nVERSION_ID=\\"10\\"\\nVERSION=\\"10 (buster)\\"\\nVERSION_CODENAME=buster\\nID=debian\\nHOME_URL=\\"https://www.debian.org/\\"\\nSUPPORT_URL=\\"https://www.debian.org/support\\"\\nBUG_REPORT_URL=\\"https://bugs.debian.org/\\"\\n"}\n', b'<stdin>:29: DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5\n')
Using module file /home/cmk/.ansible/collections/ansible_collections/checkmk/general/plugins/modules/host_group.py
<10.165.31.147> PUT /home/cmk/.ansible/tmp/ansible-local-62qrz4xr66/tmpswq9ztzp TO /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/AnsiballZ_host_group.py
<10.165.31.147> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' '[10.165.31.147]'
<10.165.31.147> (0, b'sftp> put /home/cmk/.ansible/tmp/ansible-local-62qrz4xr66/tmpswq9ztzp /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/AnsiballZ_host_group.py\n', b'')
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/ /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/AnsiballZ_host_group.py && sleep 0'"'"''
<10.165.31.147> (0, b'', b'')
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' -tt 10.165.31.147 '/bin/sh -c '"'"'/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/AnsiballZ_host_group.py && sleep 0'"'"''
<10.165.31.147> (1, b'\r\n{"changed": false, "failed": true, "msg": "Error calling API. HTTP code -1. Details: N/A", "invocation": {"module_args": {"server_url": "http://10.165.31.147/", "site": "kemp", "automation_user": "automation", "automation_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "validate_certs": false, "title": "My Host Group", "name": "my_host_group", "state": "present", "groups": []}}}\r\n', b'Shared connection to 10.165.31.147 closed.\r\n')
<10.165.31.147> Failed to connect to the host via ssh: Shared connection to 10.165.31.147 closed.
<10.165.31.147> ESTABLISH SSH CONNECTION FOR USER: root
<10.165.31.147> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/home/cmk/.ansible/cp/18abc3596d"' 10.165.31.147 '/bin/sh -c '"'"'rm -f -r /root/.ansible/tmp/ansible-tmp-1689852493.270862-67-217590670387403/ > /dev/null 2>&1 && sleep 0'"'"''
<10.165.31.147> (0, b'', b'')
fatal: [kempCMK]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"invocation": {
"module_args": {
"automation_secret": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"automation_user": "automation",
"groups": [],
"name": "my_host_group",
"server_url": "http://10.165.31.147/",
"site": "kemp",
"state": "present",
"title": "My Host Group",
"validate_certs": false
}
},
"msg": "Error calling API. HTTP code -1. Details: N/A"
}
PLAY RECAP ****************************************************************************************************************************************************************************************************
kempCMK : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0