Windows下使用Ansible應用

來源:互聯網
上載者:User

標籤:linux   windows   ansible   

環境需求:

* Controller 一定要是 Linux 

* Windows  需要:

    1.Framework 4.5

    2.PowerShell 3.0


原料:

    Ansible Master (CentOS)

    Anisble Slave (Windows SP1)


步驟:

    [Linux]

yum -y install python-kerberos.x86_64 python2-winrm.noarch


    [Windows]

    下載 Framework 4.5

http://download.microsoft.com/download/B/A/4/BA4A7E71-2906-4B2D-A0E1-80CF16844F5F/dotNetFx45_Full_x86_x64.exe

    下載 PowerShell 3.0

https://download.microsoft.com/download/E/7/6/E76850B8-DA6E-4FF5-8CCE-A24FC513FD16/Windows6.1-KB2506143-x64.msu

    安裝完成後會重啟一次


    下載 Remoting Script for Ansible

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

    使用管理員身份運行指令碼


    使用管理員身份開啟PowerShell 

winrm qc

    會出現以下錯誤

    650) this.width=650;" src="https://s3.51cto.com/wyfs02/M00/92/38/wKiom1j9c5TijbUlAANKhux-VqA613.png-wh_500x0-wm_3-wmp_4-s_1085019262.png" title="Anisble for window1.png" alt="wKiom1j9c5TijbUlAANKhux-VqA613.png-wh_50" />

    這個其實也不算是錯誤,只需要求改網路的屬性:在網路和共用中心中把公用網路,切換成家用網路

650) this.width=650;" src="https://s2.51cto.com/wyfs02/M01/92/38/wKiom1j9c8fC079BAABQIdcvgSI525.png-wh_500x0-wm_3-wmp_4-s_3163994032.png" title="ansible_windows2.png" alt="wKiom1j9c8fC079BAABQIdcvgSI525.png-wh_50" />

    再次執行

winrm qc

    這次應該是成功了,會顯示以片:

650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/92/38/wKiom1j9c9njErSCAAJ58Vf9IOY015.png-wh_500x0-wm_3-wmp_4-s_15575532.png" title="ansible_windows_3.png" alt="wKiom1j9c9njErSCAAJ58Vf9IOY015.png-wh_50" />


    接下來需要開啟windows 遠程操作的相關屬性:

winrm set winrm/config/service ‘@{AllowUnencrypted="true"}‘
winrm set winrm/config/service/auth ‘@{Basic="true"}‘

   650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/92/38/wKiom1j9dILADIXPAABnCkM4Wgo947.png-wh_500x0-wm_3-wmp_4-s_2488826887.png" title="ansible_windows5.png" alt="wKiom1j9dILADIXPAABnCkM4Wgo947.png-wh_50" /> 

    以上就可以看到連接埠5985 已經起來了

    netstat -ano | findstr 5985

650) this.width=650;" src="https://s1.51cto.com/wyfs02/M00/92/38/wKiom1j9dKGjz45BAACi-PL4yxw979.png-wh_500x0-wm_3-wmp_4-s_539272568.png" title="ansible_window4.png" alt="wKiom1j9dKGjz45BAACi-PL4yxw979.png-wh_50" />

    

    使用ansible 測試windows 主機

    

cat /etc/ansible/hosts

[windows]

10.0.50.100 ansible_ssh_user="Administrator" ansible_ssh_pass="123456" ansible_ssh_port=5986 ansible_connection="winrm"


650) this.width=650;" src="https://s2.51cto.com/wyfs02/M01/92/37/wKioL1j9dZ-it7PxAAAwMxUrtAo981.png-wh_500x0-wm_3-wmp_4-s_2134761406.png" title="ss.png" alt="wKioL1j9dZ-it7PxAAAwMxUrtAo981.png-wh_50" />


本文出自 “雷靈柯斯” 部落格,請務必保留此出處http://luweiv998.blog.51cto.com/4659209/1918756

Windows下使用Ansible應用

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.