1.主机IP ansible_user="用户名" ansible_password="密码" ansible_port=5985 ansible_connection="winrm" ansible_winrm_server_cert_validation=ignore all: children: windows: #主机组 hosts: 10.123.102.180: #主机 10.123.102.181: vars: #此变量只在windows主机组里生效,windows2主机组需要重新定义 ansible_...
一、前提: 1.1、windows机器开启winrm服务,并设置成允许远程连接状态 具体操作命令如下 set-executionpolicy remotesigned winrm quickconfig #配置auth winrm set winrm/config/service/auth '
ansible test -m user -a "name=tuser1 state=absent" 1. 删除账户tuser1,state=absent代表删除账户的意思,name指定要删除的用户名是什么 账户的家目录不会被删除,相当于执行userdel tuser1 ansible test -m user -a "name=tuser2 state=absent remove=true" #删除tuser2账户同时删除家目录、邮箱,相当于...
user:生成用户、删除用户 group:生成组、删除组 1、生成用户:ansible all -m user -a "name=test password=1DhUWqz2JZqc home=/home uid=999 comment=‘this is a ansible test user‘ shell=/bin/sh" 其中密码为123,生成方式为: openssl passwd -salt -1 "123" image.png 2、删除用户,remove是否移除...
win_product_facts – Provides Windows product and license information win_psexec – Runs commands (remotely) as another (privileged) user win_psmodule – Adds or removes a Windows PowerShell module win_psrepository – Adds, removes or updates a Windows PowerShell repository ...
kinit user@MY.DOMAIN.COM 步骤4、同理配置Inventory主机信息和group_vars/windows.yml变量信息,Inventory添加如下信息: [windows]win1.magedu.comwin2.magedu.com group_vars/windows.yml添加如下信息: ansible_user:Administratoransible_password:magedu@beijingansible_port:5986ansible_connection:winrmansible_winrm_se...
# ansible 192.168.2.2 -m win_user -a "name=testuser1 passwd=123456" windows服务管理 代码语言:javascript 复制 # ansible 192.168.2.2 -m win_shell -a“net stop|start zabbix_agent” 📓说明: 完整的windows module见: Windows modules 本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。 原始发表:...
可用的 Windows 模块 绝大部分 Module 都是针对 Linux 编写的,大部分在 Windows 下不能正常使用。目前Windows 的 Module 都是使用 PowerShell 编写的,可用的有: 各模块详细使用方法可参见:Windows Modules(http://t.cn/Eaf66BZ)。 如果你在使用过程中遇到问题,可参考官方的 Windows 常见问题处理(http://t.cn...
Ansible can be used to orchestrate a multitude of tasks on Windows servers. Below are some examples and info about common tasks. Installing Software There are three main ways that Ansible can be used to install software: Using thewin_chocolateymodule. This sources the program data from the...
#sudo_user = root #ask_sudo_pass = True #ask_pass = True #transport = smart #remote_port = 22 #module_lang = C #module_set_locale = False # plays will gather facts by default, which contain information about # the remote system. ...