ansible初步配置管理windows,ansible配置管理


一、需要安装ansible相应的windows组件,并且安装ansible的主机需要是linux系统。

二、配置hosts文件

[windows]10.20.XXx.xxx

[windows:vars]
ansible_connection=winrm
ansible_user=username
ansible_ssh_pass=password
ansible_ssh_port=5986

ansible_winrm_server_cert_validation=ignore
ansible_connection=winrm
ansible_winrm_transport=ntlm

三、测试:
$ ansible windows -m win_ping
10.20.xx.xxx | SUCCESS => {
    "changed": false,
    "ping": "pong"

}

四、其它使用

./ansible windows -m win_copy -a 'src=/otherProcess.py dest=D:\\ansible_test'


win_file —创建,删除文件或目录
ansible windows -m win_file -a "path=F:\file\passwd state=absent"


相关内容

    暂无相关文章