Ansible-windows-lab-setup (where ansible server is in linux and target node is in windows)

5 Comments



Ansible is installed in linux server and target nodes are windows
need to control the target windows nodes

dependencies:
while launching windows nodes in AWS cloud
5985 and 5986 port number should need to open
these are winrm port number

in ansible server need to install “” pywinrm””
yum install python-pip -y

pip install pywinrm

** very important note**
powershell 3.0 version and .net 4 should need to installed in target windows node

[windows]
35.**.**.**
52.*.**.***

[windows:vars]
ansible_user=Administrator
ansible_password=********
ansible_port=5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

these are vars
or this way

ansible_user: Administrator
ansible_password: ********
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_server_cert_validation: ignore

– hosts: linux
gather_facts: true
tasks:
– name: create a file in target node1and2
file:
path: /home/devops/{{ item }}
state: touch
with_items:
– one.html
– two.html
– three.py
– four.cs

– hosts: windows
gather_facts: true
tasks:
– name: create a folder in target windowsnode1 and node2
win_file:
path: C:Temp
state: directory

source

5 Comments
    • blank
      Alan John Heslop
      May 17, 2022 07:02 am Reply

      port 6986 is wrong at minute 0:20

    • blank
      Jithendra Gunuru
      May 17, 2022 07:02 am Reply

      Connection timeout comming sir

    • blank
      ArcticViper
      May 17, 2022 07:02 am Reply

      Works great, thank you.

    • blank
      Yashasvi Devang
      May 17, 2022 07:02 am Reply

      Sir…please reply

    • blank
      Yashasvi Devang
      May 17, 2022 07:02 am Reply

      Hi Vishwa- Tech
      I'm Yashaswini here
      I have a doubt .. could you please help.

      I'm done with all initial set-ups. But still Ping is not successful.
      what can be done??

Leave us a comment