ansible对windows系统的管控,ansible管控


越来越感觉baidu解决不了问题了,在baidu上找了很久资料,都没解决实质问题,下面言归正传。

环境:centos7,主控,安装ansible;win7 pro sp1 64位系统


win7系统:

1、以管理员身份执行powershell,执行get-host命令,查看版本,如果版本是2.0,需要升级到3.0

     如果powershell版本是2.0

    1.1 win7系统安装 dotNetFx30_Full_x86_x64.exe及以上版本,为的是升级powershell 2.0 到 3.0

    1.2 更改执行策略: set-ExecutionPolicy RemoteSigned

    1.3 升级PowerShell 到3.0,执行脚本:

          https://github.com/cchurch/ansible/blob/devel/examples/scripts/upgrade_to_ps3.ps1

          重启机器,并执行get-host检验,powershell版本是否升级到3.0

     1.4 执行PowerShell 配置脚本:

           https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1


centos7:

1、 yum update
   yum install net-tools
   yum install epel-release
   yum install ansible

2、新建目录并建立清单文件

   mkdir /opt/ansible_test

   vi host

   host内容:

   [windows] win7主机ip地址 3、建立yml文件并编辑    mkdir /opt/ansible_test/group_vars/windows.yml    windows.yml内容:    # it is suggested that these be encrypted with ansible-vault:
   # ansible-vault edit group_vars/windows.yml
   ansible_ssh_user: <admin user>
   ansible_ssh_pass: <admin user password>
   ansible_ssh_port: 5986
   ansible_connection: winrm
4、在/opt/ansible_test下执行命令   ansible windows -i host -m win_ping










相关内容

    暂无相关文章