【发布时间】:2021-05-06 15:09:58
【问题描述】:
我正在尝试使用 Ansible 的 shell 模块运行此命令:
openssl s_client -connect router1.lab.net:50051
我的 Ansible 游戏是这样的:
---
- hosts: lab
connection: local
tasks:
- name: Check cert with OpenSSL
shell: |
openssl s_client -connect {{ ansible_host }}:50051
register: cert
ignore_errors: yes
- name: Print cert data
debug:
msg: "{{ cert }}"
when: cert is succeeded
当我使用 -vvv 运行 playbook 时,出现以下错误:
"stderr": "139631224861120:error:0200206F:system library:connect:Connection refused:../crypto/bio/b_sock2.c:110:\n139631224861120:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111:\nconnect:errno=111",
"stderr_lines": [
"139631224861120:error:0200206F:system library:connect:Connection refused:../crypto/bio/b_sock2.c:110:",
"139631224861120:error:2008A067:BIO routines:BIO_connect:connect error:../crypto/bio/b_sock2.c:111:",
"connect:errno=111"
]
当我从 Linux 命令行运行相同的 openssl 命令并给出正确的输出时,它会起作用。
我尝试安装 ansible-galaxy collection install community.crypto (https://ansible.fontein.de/collections/community/crypto/x509_certificate_pipe_module.html) 但没有帮助。
【问题讨论】:
标签: ansible