Ansible使用变量传递密码执行realm加入AD域失败
Ubuntu虚拟机通过Ansible+Realm加入AD域的密码传递问题
我正在使用Ansible Playbook通过realm工具将Ubuntu虚拟机加入AD域。在Playbook的vars中配置了名为ad_password的变量,该密码包含字母、数字和特殊字符。我尝试过用双引号包裹密码,也试过不加引号,任务代码如下:
- name: Join the computer to the realm command: realm join -v {{ domain_controller }} --computer-ou "{{ ad_computer_ou }}" -U {{ ad_join_user }}%{{ ad_password }} register: realm_join
但执行Playbook时,该任务会无限挂起。我尝试过多种方式让Playbook交互式提供ad_join_user账户的域加入密码,要么出现身份验证错误(推测是密码传递不正确),要么就像此例一样无限挂起。
当我将密码硬编码到任务中时,域加入操作可以正常完成,示例如下:
- name: Join the computer to the realm command: /bin/bash -c "echo MY_PASSWORD_PUT_HERE | realm join -v {{ domain_controller }} --computer-ou "{{ ad_computer_ou }}" -U {{ ad_join_user }}" register: realm_join
我试过使用command模块和shell模块,但都无法通过变量(或Ansible Vault中的加密变量)传递密码完成操作。
内容的提问来源于stack exchange,提问作者Michael
相关产品推荐
相关产品推荐

