【问题标题】:WinRM password as encrypted string in ansible host file?WinRM密码作为ansible主机文件中的加密字符串?
【发布时间】:2019-09-13 12:51:00
【问题描述】:

我想使用 WinRM 通过 ansible 与我的 Windows 主机进行通信。 我已经配置了 WinRM 并在 ansible hosts 文件中以纯文本形式指定了凭据。平正在工作。 现在我想将密码指定为加密 - 但是这里最好的方法是什么?

我尝试使用 Vault 功能:

ansible-vault encrypt_string password123 --ask-vault-pass

并尝试在 hosts 文件中指定输出但没有成功。

[winclients]
testserver

[winclients:vars]
ansible_connection=winrm
ansible_winrm_transport=credssp
ansible_port=5986
ansible_winrm_scheme=https
ansible_winrm_message_encryption=always
ansible_winrm_server_cert_validation=validate
ansible_user=testuser
ansible_password=!vault |
          $ANSIBLE_VAULT;1.1;AES256
          38373237366432653838643061373035333931616466613564653836393862343939313431393064....  
      3234

但现在我收到错误消息:

testserver | UNREACHABLE! => {
    "changed": false,
    "msg": "credssp: Received error status from the server: (3221225581) STATUS_LOGON_FAILURE 0xc000006d",
    "unreachable": true
}

【问题讨论】:

    标签: windows authentication encryption ansible winrm


    【解决方案1】:

    我现在将所有内容都放入 hosts.yml 但现在的问题是 ansible 尝试通过 SSH 连接,就像它忽略了 winrm

    winclients:
      hosts:
        testserver:
          vars:
            ansible_connection: winrm
            ansible_winrm_transport: credssp
            ansible_port: 5986
            ansible_winrm_scheme: https
            ansible_winrm_message_encryption: always
            ansible_winrm_server_cert_validation: validate
            ansible_user: testuser
            ansible_password: **encrypted_value**
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-07
      • 1970-01-01
      • 2018-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-15
      • 1970-01-01
      相关资源
      最近更新 更多