You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ansible调用win_domain_user模块及AD服务器hosts文件自动化更新问题

问题与需求

我尝试在Ansible中运行community.windows.win_domain_user模块,当前使用的Playbook如下:

---
- name: connect to windows server
  hosts: win
  connection: ssh
  gather_facts: no
  
  vars:
   ansible_connection: ssh
   ansible_shell_type: cmd

  tasks:
  - name: Ensure user bob is present with address information
    community.windows.win_domain_user:
     name: Bob.c
     firstname: Bob
     lastname: Carrender
     groups:
      - Users
     domain_username: testing.com\bob.c
     domain_password: SomePas2w0rd
     domain_server: testing.com

环境信息

  • 包含更新后AD服务器信息的CSV文件存储在Ubuntu机器上
  • 需要用该CSV信息更新网格内Windows服务器的hosts文件
  • Ubuntu机器可通过SSH访问所有网格内Windows服务器,SSH连接采用密码指纹认证
  • Ubuntu机器可成功运行其他Windows Playbook
  • Windows服务器已更新本地网络策略以启用各类加密会话

执行输出截图

输出截图

核心需求

希望自动化完成网格内多台服务器hosts文件中AD服务器信息的更新操作。


内容的提问来源于stack exchange,提问作者Tim Carrender

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 17:46:02