Ansible在docker下的Failed to connect to the host via ssh: Control socket connect错误

由于客户方环境的特殊性,考虑到方便部署,运维平台已经全面应用到docker内,之前在客户方部署一直好好的,突然在给新的客户部署的时候出现了这个问题,国内网站找了一圈也没找到,最后在stackoverflow查询到类似问题
下面是错误日志,此台机器ssh都通,但ansible adhoc命令无论如何都没法使用

10.110.13.14 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Control socket connect(/root/.ansible/cp/ff32cdddd7): Connection refused\r\nFailed to connect to new control master\r\n", 
    "unreachable": true
}

快速解决办法是修改control path路径
修改/etc/ansible/ansible.cfg
设置
control_path_dir=/dev/shm/ansible_control_path


[ssh_connection]
control_path_dir=/dev/shm/ansible_control_path

具体原因没细查

    原文作者:神力无敌_61b6
    原文地址: https://www.jianshu.com/p/c07548c65387
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞